GlobalAccessSoftware icon

testing.bat

GlobalAccessSoftware | PRO | 11/16/23 05:57:18 AM UTC | 0 ⭐ | 14350 👁️ | Never ⏰ | []
Batch |

15.95 KB

|

Software

|

0 👍

/

0 👎

 
 
::: RC9 Update! ::: 
 
::: KEEP! ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  @echo off
  cls
  :::::::: Experimental Module Keep this header! ::::::::
  if not defined bats set bats=C:\Users\%username%\Documents\AAA Sync2Laptop\Batch Files\BCS-Suite
  title %date% @ %time% testing.bat by -JpE-
  if not defined vers set vers=v8.7.0.11 20231108073214 by -JpE-
  set sl=         /*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\
  set l1=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  set l2=\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
 
  REM set util1="%bats%\utility1.bat"
  if not defined util2 set util2="%bats%\utility2.bat"
  if not defined util3 set util3="%bats%\utility3.bat"
 
::: set testwell=3 or 5 to test and crosscheck a section.
  set testwell=0
  REM set testwell=1
  REM set testwell=3
  REM set testwell=5
REM goto forbreak
  REM goto testtools
 
 
::: skip too ma'lou my darlin'
    set silent="%bats%\Silent_mode.bat"
    if not exist %silent% echo . & echo Silent can't be found. & echo . & pause & echo . & echo TERMINATING! & echo . & pause & echo . & exit /b
    set /a code2=7 & call %silent%
    echo TERMINATING! & echo . & pause & echo .
    
  REM set testwell=3
  REM set testwell=5
  set testwell=0
  goto testtools
 
 
:getgap2
  call %util3% spc1 spc2 "%line2%" "%chars2Pad%" "%str%"
  call %util3% charrev :revchars "%chars2Pad%"
if %testwell% gtr 0 echo . & echo Back in testing:
if %testwell% gtr 0 echo . & echo The spcs for gap1 are "%spc1%" and
if %testwell% gtr 0 echo the spcs for gap2 are "%spc2%" & echo . & pause & echo .
 
  call :exhibit
if %testwell% gtr 0 echo . & echo NOW TERMINATING!
if %testwell% gtr 0 echo . & pause
if %testwell% gtr 2 exit
  goto test1
 
 
:exhibit
  set chars=Ho!
  call %util3% rrev :revchars "%chars%"
  set txt1=I don't really care do you mate?
  call %util3% myl1n3 :makeline "%chars%" "%txt1%"
  set myline=%myl1n3%
  call %util3% spc1 spc2 %myl1n3% "%chars%" "%txt1%"
if %testwell% gtr 2 echo . & echo exhibit says spc2 == "%spc2%" & echo . & pause & echo .
  echo . & echo %myline%
  echo %rrev%%spc1% %txt1% %spc2%%rrev%
  echo %myline% & echo .  
if %testwell% gtr 2 echo . & pause & echo . & pause & echo . & pause & echo .
  exit /b %errorlevel%
 
 
  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  ::: Get it to store the random values it finds in a List :::
  ::: for practice with psuedo arrays, sequences, etc.     :::
  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
 
::: v8.6.8.96 20230920193542 by -JpE-
:testtools
  set str0=My little test text says very little, probably, huh?
  set chars2Pad=-*=
  set /a gap=0
  
  REM set length=0 & set gar=0 & set spc0=
  call %util3% charrev :revchars "%chars2Pad%"
  call %util3% line2 :makeline "%chars2Pad%" "%str0%"
  if %gap% gtr 0 call %util3% spcs :getspcs %gap%
  call %util3% length :strlen "%str0%"
  call %util3% gar :strlen "%chars2Pad%"
  echo . & echo The length of "%str0%" is %length% & echo . & echo The reverse of %chars2Pad% is %charrev% & echo . & echo The line for "%str0%" is: & echo .
  echo %line2% & echo %charrev% %str0% %spcs%%charrev% & echo %line2% & echo .
 
  set /a gap0=3
  if %gap0% gtr 0 call %util3% spc0 :getspcs %gap0%
  echo . & echo The spcs for %gap0% are "%spc0%" & echo .
if %testwell% gtr 2 pause & echo .
pause & echo .
  goto getgap2
 
 
:test1
  set /a count1=0
  REM goto prototype
  
 
:prototype
  choice /c ync /n /t 9 /d n /m "Run the substr test first? (y/N/c): " & echo .
  if errorlevel 3 echo CANCELLED! & echo . & exit
  if errorlevel 2 goto doit
  if errorlevel 1 call :testsubstr
  echo .
  if %errorlevel% neq 3 (
    choice /c ync /n /t 9 /d y /m "Run the dowtests now? (Y/n/c): "
    echo .)
  if %errorlevel% equ 3 echo CANCELLED!
  if %errorlevel% equ 2 echo Terminating.
  if %errorlevel% neq 1 exit /b
  goto doit
 
 
:::::::::::::::::::::::
::: Now Testing.... :::
:::::::::::::::::::::::
:test2
  set msg="***** Test it again, from the Top. Ready? ***** (Y/n/c): "
  echo . & choice /c ync /n /t 20 /d y /m %msg% & echo .
  if %errorlevel% gtr 1 exit /b
  set l00kup=
  set reset=0
    REM cls
  echo . & echo .
  goto dowtest
 
 
:doit
  setlocal EnableExtensions
  setlocal EnableDelayedExpansion
 
 
:dowtest
  if exist %util2% call %util2% day1
  echo . & echo Today is %day1% & echo .
  set /a count1+=1
  if not defined l00kup echo Skipit & goto skipit
 
  ::: Now an implicit value : if defined l00kup ::: 
  if exist %util3% call %util3% leng :strlen "%l00kup%"
 
    set /a offset12=(%leng%-10)
    set /a l3n=(%leng%-6)
    set /a m0n=(%offset12%+5)
    set /a d3y=(%offset12%+8)
 
  REM setlocal EnableExtensions
  REM setlocal EnableDelayedExpansion
    set t3mp=!l00kup:~0,%l3n%!
    set rest0f=!l00kup:~%l3n%,6!
  REM setlocal DisableDelayedExpansion
  REM setlocal DisableExtensions
    set /a t3mpy=(%t3mp%)
    set "r3st0f=%rest0f%"
    set /a t3mpy+=100
 
  ::: Nothing over 2,147,483,647 Fatal Error, for now.
  if %t3mpy% gtr 2147483646 echo overload & if exist %util3% call %util3% t :overload 0
  if %t3mpy% gtr 2147483646 goto test2
 
  if %t3mpy% leq 0 echo overload & if exist %util3% call %util3% t :overload 0
  if %t3mpy% leq 0 goto test2
 
      ::: Otherwise fine...
      set l00kup=%t3mpy%%r3st0f%
 
:skipit
  if not defined l00kup (
    ::::::::::::::::::::::::::::::
    ::: MAX DATE IN YEARS A.D. :::
    ::: 2,147,483,647 years.   :::    
    ::::::::::::::::::::::::::::::
    REM i.e. set l00kup=2147483047-01-09
    REM set l00kup=2147483447-01-09
    set l00kup=2147482599-01-09
    REM set l00kup=999996999-01-09
    REM set l00kup=99999699-01-09
    REM set l00kup=9998599-01-09
    REM set l00kup=998796-01-09
    REM set l00kup=123456-01-09
    REM set l00kup=99899-01-09
    REM set l00kup=9696-01-09
    REM set "l00kup=10056-05-20"
    REM set l00kup=1956-05-20
    REM set l00kup=1523-01-09
    if not exist %util3% echo util3 not found. & echo . & pause & echo .
    if exist %util3% call %util3% lup :strlen %l00kup%
 
      set /a l3n=%lup%-6
      set /a d1f=%l3n%-4
      set /a m0n=%d1f%+5
      set /a d3y=%d1f%+8
  )
 
      if exist %util2% call %util2% d4y %l00kup%
      
  REM setlocal EnableExtensions
  REM setlocal EnableDelayedExpansion
  set /a yr1=(!l00kup:~0,%l3n%!)
  set "mo1=!l00kup:~%m0n%,2!"
  set "dy1=!l00kup:~%d3y%,2!"
  REM setlocal DisableDelayedExpansion
  REM setlocal DisableExtensions
  
      ::: Finally the fix for this:
      ::: Switch to number here, no sooner. Except year. 4Y v
      if %mo1:~0,1% equ "" set /a mo1=(%mo1:~1,1%)
      if %mo1:~0,1% equ " " set /a mo1=(%mo1:~1,1%)
      if %mo1:~0,1% equ "0" set /a mo1=(%mo1:~1,1%)
 
      if %dy1:~0,1% equ "" set /a dy1=(%dy1:~1,1%)
      if %dy1:~0,1% equ " " set /a dy1=(%dy1:~1,1%)
      if %dy1:~0,1% equ "0" set /a dy1=(%dy1:~1,1%)
 
  set /a yr2=%date:~0,4%
  set "mo2=%date:~5,2%"
  set "dy2=%date:~8,2%"
 
    ::: NOTE switchover from string to number here. No sooner. Except year.
    if %mo2:~0,1% equ "" set /a mo2=(%mo2:~1,1%)
    if %mo2:~0,1% equ " " set /a mo2=(%mo2:~1,1%)
    if %mo2:~0,1% equ "0" set /a mo2=(%mo2:~1,1%)
    
    if %dy2:~0,1% equ "" set /a dy2=(%dy2:~1,1%)
    if %dy2:~0,1% equ " " set /a dy2=(%dy2:~1,1%)
    if %dy2:~0,1% equ "0" set /a dy2=(%dy2:~1,1%)
 
        set tense1=was
        if %yr1% gtr %yr2% set tense1=will be
        if %yr1% equ %yr2% if %mo1% gtr %mo2% set tense1=will be
        if %yr1% equ %yr2% if %mo1% equ %mo2% if %dy1% gtr %dy2% set tense1=will be
 
    echo . & echo The date %l00kup% %tense1% a %d4y%! & echo .
    if %count1% gtr 345 echo WARNING! Loop count is now at %count1%/360, where the program will terminate. & echo .
      if %count1% leq 360 choice /c ync /n /t 10 /d y /m "%count1%) Run the tests again? (Y/n/c): "
      if %errorlevel% gtr 2 exit /b
      if %errorlevel% equ 2 goto test2
      if %count1% lss 360 goto dowtest
      
        set /a reset1+=1 & echo . & choice /c ync /n /t 20 /d n /m "Reset The Counter? (y/N/c): "
        if %errorlevel% gtr 1 echo . & exit /b
        if %reset1% gtr 1 goto lastchance
          ::: ELSE
          set /a count1=0
          goto dowtest
 
 
:lastchance
  echo . & echo LAST CHANCE BEFORE TERMINATION! & echo . & choice /c ync /n /t 1200 /d c /m "Reset the reset counter? (y/n/C): "
  set /a count1=0 & set l00kup=
  if %errorlevel% equ 1 goto dowtest
  exit /b
 
 
:testsubstr
  if not exist %util3% exit /b
  setlocal
:testsub
  set /a start=0 & set date3=12345678-05-20
  call %util3% lng :strlen %date3%
  set /a lent=(%lng%-6)
  setlocal EnableExtensions
  setlocal EnableDelayedExpansion
  set "str4=!date3:~%start%,%lent%!"
  setlocal DisableDelayedExpansion
  echo . & echo The Year of %date3% is %str4% & echo .
  choice /c ync /n /t 5 /d n /m "Run testsubstr Again? (C) to Cancel ALL: (y/N/c)? "
  if %errorlevel% equ 1 goto testsub
  endlocal
  exit /b
 
 
:forbreak
  set /a loops=32
  for /l %%i in (1, 1, %loops%) do (
    call :myloop
    if %%i equ 20 echo Breaking at %%i & pause & goto eloop
    echo . & echo i == %%i
    echo loops == %loops% 
  )
:eloop
  echo . & echo program terminating. & echo . & pause & echo .
  exit /b  
:myloop 
  exit /b  
 
 
:::::::::::::[ END of Now Testing ]::::::::::::
 
 
REM :::::::::::::::::::::::::::::
REM ::: Deprecated  v8.6.8.94 :::
REM :::::::::::::::::::::::::::::
REM :y10k
  REM echo . & echo  There is a Y10k Problem after 9999 A.C.E. & echo .
  REM set msg="Start the tests again? (Y/n): "
  REM choice /c yn /n /t 20 /d y /m %msg%
  REM if %errorlevel% equ 1 set l00kup=
  REM if %errorlevel% equ 1 goto dowtest
  REM exit
 
 
  :::::::::::::::::::::::::::::::::::::::::::::
  ::: Recently tested or experimented with. :::
  :::::::::::::::::::::::::::::::::::::::::::::
:dowtest2
  call :dowtest
  set /a count=1
  set /a limit=10000
  call :begin
 
  REM set Slnt="%bats%\Silent_mode.bat"
  REM call %Slnt%
  REM exit
 
:::::::::::::[ END of Recent Testing ]::::::::::::
 
 
:basenum2
  set /a baseNumber=10 & set /a exponent23=19
  call :powers2 result %baseNumber% %exponent23%
  echo . & echo %baseNumber%\%exponent23% == %result% & echo . & pause & echo .
  ::: 
  set /a b=2 & set /a e=32
  
:loop
  call :powers2 x %b% %e%
  echo %b%\%e% == %x%
  if %e% gtr 0 set /a e+=-1 & goto loop
  pause
  set /a e=32
  if %b% lss 32 set /a b+=1 & goto loop
  echo . & pause & echo .
 
  :::::::::::::::::::::::::::::::::::::::::::::::
  ::: Previously tested or experimented with. :::
  :::::::::::::::::::::::::::::::::::::::::::::::
 
  call :top
  call :power
  call :leapyear
  call :datums
  call :menudo
  REM set /a count=1
  REM set /a limit=10^40
  REM call :begin
  :: REM goto power
  :: REM goto leapyear
  :: REM goto datums
  :: REM goto menudo
  :: REM goto begin
  exit /b %errorlevel%
 
:::::::::::::::::::::::: END KEEP :::::::::::::::::::::::::
 
:top
  pause
  call :showmsgt
  set msg="%bats%\exit_main.bat"
  if exist %msg% echo . & echo %msg% is online. & echo .
  if not exist %msg% echo . & echo %msg% is not online. & echo .
  ::: Okay down to here.
  echo calling exit_main... 
  pause
  if exist %msg% call %msg% showmsg2
  REM set fileo="%bats%\caller_check.txt"
  echo back from showmsg2
  pause
  goto top
 
  echo error error error error error error error error error
  pause
  exit /b %errorlevel%
 
 
:showmsgt <no parms>
  echo . & echo made it to :showmsg2 in testing & echo .
 
  echo This file lets the Older Photos & 
  echo Program know which program is
  echo calling it, if any.
  echo .
  echo This does not effect your files
  echo that are being backed up in any way.
  echo . & echo Leaving showmsgt & echo . & pause & echo .
  exit /b %errorlevel%
 
 
:begin
  REM echo .
  if %count% gtr %limit% echo . & echo End of Run, limit reached. & echo . & pause & echo . & exit /b %errorlevel%
  REM echo Ready?
  REM echo .
  set /a a=%RANDOM%
  REM pause
 
  REM if %a% equ 0 goto react
  REM if %a% gtr 3200 goto react
 
  REM echo . & 
  REM echo a not 0 or greater than 3200.
  REM echo . & 
  echo Our Random Number is: %a%
   REM & echo .
  set /a count+=1
  rem & pause & goto begin
  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  ::: Get it to store the random values it finds in a List for practice with psuedo arrays, sequences, etc.
  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  goto begin
 
 
:react
  REM echo a got flagged because a equals zero or is greater than 3. a == %a% & goto begin
  REM echo .
  REM echo It didn't work.
  REM echo .
  REM pause
  REM echo .
  goto begin
 
 
:daddio
  set daddio="\\Daddio-PC\Users\Admin\AppData\Local\Microsoft\Outlook"
  if not exist %daddio% echo Daddio not found. & pause & exit /b 2
  echo . & echo Daddio is online. & echo . & pause
  exit /b %errorlevel%
 
 
:menudo
  cls
  echo .
  echo                   %date%  @  %time%
  echo .
  set l=5 3 7 12 89 91 14 17 25 65 72 13 18 27 47 32 4 12 15 13 64 30 29 44 31 21 75 46 73 26 16 43 0 19 42 5 7 1 11 57
  ( for %%n in (%l%) do (
    echo n == %%n
  ))
  echo .
  pause
  echo .
  exit /b %errorlevel%
 
 
:paws
  echo Paws-1
  pause
  for /L %%x in (0,1,3) do (
  echo Hi! %%x
  pause
  )
  echo Paws-2
  pause
 
 
:datums
  ::: set datum[x][y][z]=num
  set datum[0][0][0]=0
 
  set list=5,3,7,12,89,91,14,17,25,65,72,13,18,27,47,32,4,12,15,13,64,30,29,44,31,21,75,46,73,26,16,43,0,19,42,5,7,1,11,57
  for %%n in (%list%) do (
    for /l %%x in (0,1,3) do (
      for /l %%y in (0,1,1) do (
        for /l %%z in (0,1,3) do (
          set /a datum[%%x][%%y][%%z]=%%n
          echo n == %%n, x == %%x, y == %%y, z == %%z
  ))))
 
  echo datum[3][0][2] == %datum[3][0][2]%
 
  pause
  REM goto datums
  exit /b %errorlevel%
 
 
:leapyear
  set /a year=1900
  
:testing
  set /a year+=1
  ::: TESTING it with JUST...
  ::: Design Note to Dev: If divide by 2 equal mod 0 it's even ie. offline otherwise odd ie. problemo.
  set /a "mod=%year% %% 4%"
  set not=
  if %mod% neq 0 set not=NOT 
  set answ=Is %not%a Leapyear.
  set msg= %year% %answ%.
  echo %msg%
  set /a tsf="mod=%year% %% 42%"
  if %tsf% equ 0 pause & cls & echo %msg%
  if %year% gtr 2212 exit /b %errorlevel%
  goto testing
 
 
:power
  set /a pwr=1
  echo . & echo . & echo .
  echo Today is %date%, it is %time% & echo .
  
:start
  set /a x=1
  set datethen=%date%
  set timethen=%time%
  call :powers e,10,pwr
  for /l %%j in (%x%,1,%e%) do (
    echo This is going soooo fast! #%%j
    if %%j equ %e% echo . & echo Duuudddeee! & call :grunt
  )
  if %pwr% geq 6 exit /b %errorlevel%
  set /a pwr+=1 & goto start
 
 
:grunt
  set bats=C:\Users\%username%\Documents\AAA Sync2Laptop\Batch Files\BCS-Suite
  set runt="%bats%\runtime_display.bat"
  title %date% @ %time% Experimental Dream:
  set fileo="%bats%\caller_check.txt"
  if exist %fileo% del /f /s /q %fileo%"
  if not exist %runt% echo %runt% cannot be found!
  if exist %runt% call %runt%
  REM if %pwr% geq 6 goto return
  echo . & echo Running Again! This Time Counting To %e%0
  echo . & pause & cls
  exit /b %errorlevel%
 
 
::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:powers <intVar rslt, intVar base, intVar expo>
  setlocal & set "base=%~2" & set "expo=%~3" & set "answ=1"
  for /l %%n in (1, 1, %expo%) do (
    set /a "answ *=%base%"
    )
  endlocal & set "%~1=%answ%"
  exit /b %errorlevel%
::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
 
:powers2 <intVar returnedResult, intVar baseNum, intVar exponent>
  setlocal & set "base=%~2" & set "expt=%~3"
  set fn="%bats%\exponential_powers.bat"
  if exist %fn% call %fn% ans %base% %expt%
  endlocal & set "%~1=%ans%"
  exit /b %errorlevel%
 
 
:return
echo .
echo That's A MILLION!
echo .
pause
echo .
echo Program Terminating now. Go to Bed.
pause
exit
exit
 
 
 
:::   100%  -JpE-
 
 
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎