Monday, June 13, 2016

Perl testing: assert_equals('1010.xxx','1010xxx')

I have wasted quite a bit of time with various Perl test packages that either make assert_equals the same as assert_num_equals, or which try to guess whether the arguments should be treated as strings or numbers.

Especially since I often am testing bitstrings for instruction decoding, that often look a lot like integers.

Test::Unit::Assert - search.cpan.org: "assert_equals"

# Or, if you don't mind us guessing
    $self->assert_equals('expected', $actual [, $optional_message]);

I am just bitching,  but I begin to feel that
assert_equals
should be
assert_string_equals
by default, not the less exact
assert_num_equals
 - since the worst that can happen is that a test fails, and you can quickly fix it.

Versus falsely passing a test - bad.

---

I know, I am (probably) not using the best Perl test or assert package.

So many choices! :-(

No comments:

Post a Comment