got and want are compared by value: numbers of any width, strings, enums, arrays element
by element (fixed, view and resizable alike) and structs member by member. Strings and arrays
that differ get a diff.
expect_equal(2 + 2, 4);
expect_equal("abc", "abc");
expect_equal(s32.[1, 2, 3], s32.[1, 2, 3]);
expect_equal(2 + 2, 4, "cut point 3"); // on failure, the message leads the difference- got: the value under test.
- want: the value it must equal.
- message: what to say before the difference, such as which case of a loop failed.
- loc: where the check is written, shown when it fails. Leave the default.
expect_equal :: (
got: $T,
want: $U,
message := "",
loc := #caller_location
) -> bool
got and want are compared by value: numbers of any width, strings, enums, arrays element
by element (fixed, view and resizable alike) and structs member by member. Strings and arrays
that differ get a diff.
Parameters
- got: $T
- the value under test.
- want: $U
- the value it must equal.
- message := ""
- what to say before the difference, such as which case of a loop failed.
- loc := #caller_location
- where the check is written, shown when it fails. Leave the default.
Returns
- bool
expect_equal(2 + 2, 4);
expect_equal("abc", "abc");
expect_equal(s32.[1, 2, 3], s32.[1, 2, 3]);
expect_equal(2 + 2, 4, "cut point 3"); // on failure, the message leads the difference