@echo off

set EXE=AutoCorr

del /F bad.bad                                 2>nul
del /F report.txt                              2>nul
set DR=%CD%
if %DR%_ == _ goto lerr2
echo =========================== >>report.txt 

del /F %DR%\ZAK\tab_out.txt %DR%\ZAKd\tab_out.txt %DR%\ZA2\tab_out.txt %DR%\ZA5\tab_out.txt %DR%\Z12-1\tab_out.txt %DR%\Z12-2\tab_out.txt %DR%\Z12-3\tab_out.txt %DR%\Z12-4\tab_out.txt %DR%\Z12-5\tab_out.txt %DR%\Z12-6\tab_out.txt %DR%\ZA3\tab_out.txt %DR%\ZA4\tab_out.txt %DR%\DI1\tab_out.txt %DR%\DIV\tab_out.txt %DR%\ZAK2\tab_out.txt %DR%\ZAK3\tab_out.txt %DR%\DIV3\tab_out.txt %DR%\INKZ\tab_out.txt %DR%\INKU\tab_out.txt %DR%\INKK\tab_out.txt %DR%\INKZ2\tab_out.txt %DR%\INKL\tab_out.txt %DR%\INCL_UDL\tab_out.txt %DR%\INCL2_UDL\tab_out.txt %DR%\INCL3_UDL\tab_out.txt %DR%\INCL3_UDL1W\tab_out.txt %DR%\INCL4_UDL\tab_out.txt %DR%\INCL5_UDL\tab_out.txt %DR%\INCL_SUBDIRS_UDL\tab_out.txt %DR%\ASC\tab_out.txt %DR%\ASN\tab_out.txt %DR%\INK\tab_out.txt %DR%\IN1\tab_out.txt %DR%\tbt\tab_out.txt  %DR%\rgi\tab_out.txt  %DR%\tkb\tab_out.txt  %DR%\tx2-big\tab_out.txt  %DR%\tk1\tab_out.txt %DR%\tk2\tab_out.txt %DR%\tk3\tab_out.txt %DR%\tk4\tab_out.txt %DR%\rgi_ao\tab_out.txt  2>nul
del /F %DR%\FZAK\tab_out.txt %DR%\FZA2\tab_out.txt %DR%\FZA3\tab_out.txt %DR%\FZA4\tab_out.txt %DR%\FDI1\tab_out.txt %DR%\FDIV\tab_out.txt %DR%\FZAK2\tab_out.txt %DR%\FZAK3\tab_out.txt %DR%\FDIV3\tab_out.txt %DR%\FINKZ\tab_out.txt %DR%\FINKU\tab_out.txt %DR%\FINKK\tab_out.txt %DR%\FINKZ2\tab_out.txt %DR%\FINKL\tab_out.txt %DR%\FINCL_UDL\tab_out.txt %DR%\FINCL2_UDL\tab_out.txt %DR%\FINCL3_UDL\tab_out.txt %DR%\FINCL4_UDL\tab_out.txt %DR%\FASC\tab_out.txt %DR%\FASN\tab_out.txt %DR%\FINK\tab_out.txt %DR%\FIN1\tab_out.txt %DR%\Ftbt\tab_out.txt  %DR%\Frgi\tab_out.txt  %DR%\Ftkb\tab_out.txt %DR%\Ftx2-big\tab_out.txt  %DR%\Ftk1\tab_out.txt %DR%\Ftk2\tab_out.txt %DR%\Frgi_ao\tab_out.txt   2>nul
del /F %DR%\IRLAS\tab_out.txt   2>nul
del /F %DR%\DIV-inc-subfolders\tab_out.txt   2>nul
del /F %DR%\DIV-well-prefix\tab_out.txt   2>nul
del /F %DR%\test-las\tab_out.txt %DR%\test-las2\tab_out.txt  %DR%\test-las2\DEV-TVD 2>nul
del /F %DR%\T\tab_out.txt %DR%\L\tab_out.txt %DR%\DE2\tab_out.txt   2>nul
del /F %DR%\ZA5ExtAlt\tab_out.txt %DR%\ZA2ExtAlt\tab_out.txt %DR%\ZA3ExtAlt\tab_out.txt %DR%\ZAK_TEST0XY\tab_out.txt 
del /F %DR%\xZAKx_COORD_TVDSS\tab_out.txt %DR%\xZAKx_COORD_TVD\tab_out.txt %DR%\xZAKx_COORD_UDL\tab_out.txt %DR%\xZAKx\tab_out.txt %DR%\xZAKx_column_COORD_UDL\tab_out.txt %DR%\xZAKx_column_TVD\tab_out.txt %DR%\xZAKx_column_COORD_TVD\tab_out.txt %DR%\xZAKx_column_UDL\tab_out.txt %DR%\xZAKx_column_TVDSS\tab_out.txt %DR%\xZAKx_column_COORD_TVDSS\tab_out.txt %DR%\xZAKx_TVDSS\tab_out.txt %DR%\xZAKx_TVD\tab_out.txt 
del /F %DR%\xZAKx_Angle_Azim\tab_out.txt %DR%\xZAKx_Angle_Azimi\tab_out.txt %DR%\xZAKx_column_Angle_Azim\tab_out.txt %DR%\xZAKx_column_Angle_Azimi\tab_out.txt
del /F %DR%\xZAKx_COORD_TVDSS\tab_out.txt %DR%\xZAKx_COORD_TVD\tab_out.txt %DR%\xZAKx_COORD_UDL\tab_out.txt %DR%\xZAKx\tab_out.txt %DR%\xZAKx_column_COORD_UDL\tab_out.txt %DR%\xZAKx_column_TVD\tab_out.txt %DR%\xZAKx_column_COORD_TVD\tab_out.txt %DR%\xZAKx_column_UDL\tab_out.txt %DR%\xZAKx_column_TVDSS\tab_out.txt %DR%\xZAKx_column_COORD_TVDSS\tab_out.txt %DR%\xZAKx_TVDSS\tab_out.txt %DR%\xZAKx_TVD\tab_out.txt
del /F %DR%\xZAKx_column_Angle_Azim_ext_declination\tab_out.txt
del /F %DR%\INK2\tab_out.txt %DR%\INK3\tab_out.txt 

set NTotal=113

call one_test.bat 112 %NTotal% INK2 %EXE% %DR% 
call one_test.bat 113 %NTotal% INK3 %EXE% %DR% 
:llll
cd test-las
echo check equal wells >con
..\%EXE%.exe /w %DR%\test-las\TestLas.lst %DR%\test-las\tab_out.txt %DR%\zak.lck
cd ..

cd test-las2
echo check equal wells2 >con
..\%EXE%.exe /w %DR%\test-las2\TestLas.lst %DR%\test-las2\tab_out.txt %DR%\zak.lck
cd ..

:l1

set PAR=0.2 -r10
set PAREXACT=0.02 -r10

CompareTabs.exe %DR%\tab_out.txt  %DR%\INK2\tab_out.txt  %PAR%
CompareTabs.exe %DR%\tab_out.txt  %DR%\INK3\tab_out.txt  %PAR%

:l2

if not exist %DR%\test-las\tab_out.txt goto l22
echo Following wells differ from the first well: >>report.txt
type %DR%\test-las\tab_out.txt >>report.txt
type %DR%\test-las\tab_out.txt >>bad.bad
echo =========================== >>report.txt 

:l22

if exist bad.bad goto le
echo All is OK
echo All is OK >>report.txt 
notepad report.txt 
exit
:le

echo Some errors found. Check your program!!!!!!!!!
echo In subfolder Plugins you can find last versions of program DLL.
echo Try to copy DLL from folder Plugins into program subfolder ...\wlas\Plugins\

echo Some errors found. Check your program!!!!!!!!! >>report.txt 
echo In subfolder Plugins you can find last versions of program DLL. >>report.txt 
echo Try to copy DLL from folder Plugins into program subfolder ...\wlas\Plugins\  >>report.txt 

notepad report.txt 
exit
:lerr2
echo This is not Shell of Windows2000 or WindowsXP
echo Sorry...