' SimpleTestCase.ab

#console

Dim hStdOut = _System_hConsoleOut

Dim csbi As CONSOLE_SCREEN_BUFFER_INFO
GetConsoleScreenBufferInfo(hStdOut, csbi)

#include "SimpleTestCase.idx"

Sub UnitTest( msg As String, isSuccessful As Boolean )
	Dim resultStr = Nothing As String
	If isSuccessful Then
		resultStr = Ex"OK      "
	Else
		resultStr = Ex"FAILURE!"
	End If

	If Not isSuccessful Then
		SetConsoleTextAttribute(hStdOut, BACKGROUND_RED Or BACKGROUND_GREEN Or BACKGROUND_INTENSITY)
	End If

	Print resultStr; msg

	If Not isSuccessful Then
		SetConsoleTextAttribute(hStdOut, csbi.wAttributes)
	End If
End Sub

Sub UnitTest( msg As String, test As String, expectation As String)
	If test = expectation Then
		Print Ex"OK      "; msg
	Else
		SetConsoleTextAttribute(hStdOut, BACKGROUND_RED Or BACKGROUND_GREEN Or BACKGROUND_INTENSITY)
		Print Ex"FAILURE!"; msg
		Print "  test string = '" + test + "'"
		SetConsoleTextAttribute(hStdOut, csbi.wAttributes)
	End If
End Sub

Print "Please enter any key"
Dim a As Long
Input a
