Disclaimer

The content of this blog is my personal opinion only. Although I am an employee - currently of Nvidia, in the past of other companies such as Iagination Technologies, MIPS, Intellectual Ventures, Intel, AMD, Motorola, and Gould - I reveal this only so that the reader may account for any possible bias I may have towards my employer's products. The statements I make here in no way represent my employer's position, nor am I authorized to speak on behalf of my employer. In fact, this posting may not even represent my personal opinion, since occasionally I play devil's advocate.

See http://docs.google.com/View?id=dcxddbtr_23cg5thdfj for photo credits.

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: