2 :: PROJECT: ReactOS CMD Testing Suite
3 :: LICENSE: GPL v2 or any later version
4 :: FILE: lib/testlib.cmd
5 :: PURPOSE: Library with functions available for all tests
6 :: COPYRIGHT: Copyright 2008 Colin Finck <mail@colinfinck.de>
9 :: Indicate that a test ran successfully
12 set /a successful_tests+=1
16 :: Indicate that a test failed
17 :: @param 1 Description of the test that failed
20 set /a failed_tests+=1
21 echo Test "%~1" failed!
25 :: Test whether a call succeeded
26 :: @param 1 The test command to run and check
30 if "%errorlevel%" == "0" (
38 :: Test whether a call failed
39 :: @param 1 The test command to run and check
43 if "%errorlevel%" == "0" (
51 :: Test the value of a variable
52 :: @param 1 The variable to check (like %test%)
53 :: @param 2 The variable name (like test)
54 :: @param 3 The expected result (like 5)
55 :: If this parameter wasn't given, _testvar checks if the variable is not ""
58 set testvar_operator=not
63 if %testvar_operator% "%~1" == "%~3" (
66 call :_failed "if %%~2%% == %~3, actual result was %~1"