Grian
09/29/2020, 12:46 PMkotlin.test.assertEquals
a list of valid expected outputs, like can i just pass it a list and if the output of whatever im testing is part of that list itll say the test passed?Vampire
09/29/2020, 12:53 PMassertTrue
or expect
yogi
09/29/2020, 1:05 PMassertEquals (expectedOutput.intersect(resultOutput), resultOutput, "Expected $resultOutput to be a subset of $expectedOutput" )
Vampire
09/29/2020, 1:28 PMassertTrue
would be better.
There is no need to do a full intersect when you just want to know whether one list contains the other. So it should be assertTrue(expectedOutput.containsAll(resultOutput), "my message")
which can abort as soon as it found a discrepancy.
Or in the case how I understood it assertTrue(expectedOutput.contains(resultOutput), "my message")
Grian
09/29/2020, 1:36 PMVampire
09/29/2020, 1:37 PMCedrick Cooke
09/29/2020, 4:43 PMassertContains
and assertContainsAll
with automatic error messages are likely worthwhile functions to create.