Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix arrays comparison #18

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions UnitTestFramework.brs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function BaseTestSuite()
this.eqValues = BTS__EqValues
this.eqAssocArrays = BTS__EqAssocArray
this.eqArrays = BTS__EqArray
this.baseComparator = BTS__BaseComparator
this.compare = BTS__BaseCompare

return this
End Function
Expand Down Expand Up @@ -591,8 +591,8 @@ End Function
'
' @return True if values are equal or False in other case.
'----------------------------------------------------------------
Function BTS__EqValues(Value1 as dynamic, Value2 as dynamic, comparator = m.baseComparator as Function) as Boolean
return comparator(value1, value2)
Function BTS__EqValues(Value1 as dynamic, Value2 as dynamic) as Boolean
return m.compare(value1, value2)
End Function

'----------------------------------------------------------------
Expand All @@ -602,7 +602,7 @@ End Function
' @param Value2 (dynamic) A second item to compare.
'
' @return True if values are equal or False in other case.
function BTS__BaseComparator(value1 as Dynamic, value2 as Dynamic) as Boolean
function BTS__BaseCompare(value1 as Dynamic, value2 as Dynamic) as Boolean
value1Type = type(value1)
value2Type = type(value2)

Expand Down
2 changes: 1 addition & 1 deletion samples/SimpleTestApp/dev/source/main.brs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sub RunUserInterface(args)
Runner = TestRunner()
Runner.logger.SetVerbosity(2)
Runner.logger.SetEcho(true)
Runner.SetFailFast(true)
Runner.SetFailFast(false)
Runner.Run()
end if
end sub
Expand Down
24 changes: 24 additions & 0 deletions samples/SimpleTestApp/dev/source/tests/Test__Main.brs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Function TestSuite__Main() as Object
this.addTest("CheckStreamFormatType", TestCase__Main_CheckStreamFormatType)
this.addTest("TestAddPrefixFunction__Failed", TestCase__Main_TestAddPrefixFunction__Failed)
this.addTest("TestAddPrefixFunction__Passed", TestCase__Main_TestAddPrefixFunction__Passed)
this.addTest("TestComparesAssociativeArrays", TestCase__Main_TestComparesAssociativeArrays)
this.addTest("TestComparesArrays", TestCase__Main_TestComparesArrays)

return this
End Function
Expand Down Expand Up @@ -121,6 +123,28 @@ Function TestCase__Main_TestAddPrefixFunction__Failed() as String
return m.assertNotInvalid(result, "Input data is invalid. All values should be strings.")
End Function

'----------------------------------------------------------------
' Compares two identical associative arrays
'
' @return An empty string if test is success or error message if not.
'----------------------------------------------------------------
Function TestCase__Main_TestComparesAssociativeArrays() as String
array = { key1: "key1", key2: "key2" }

return m.assertEqual(array, array)
End Function

'----------------------------------------------------------------
' Compares two identical arrays
'
' @return An empty string if test is success or error message if not.
'----------------------------------------------------------------
Function TestCase__Main_TestComparesArrays() as String
array = ["one", "two"]

return m.assertEqual(array, array)
End Function

'----------------------------------------------------------------
' Generates valid input object and pass it to function.
'
Expand Down