Hi,

Posting in case: (1) others find this useful; (2) to seek feedback on code 
(still wandering around in the dark a little); (3) to find out if similar 
already exists.

These are a couple of macros that are like @assert, but which print out the 
actual values, instead of the expression.

So, for example, I have some code like:

    # 
http://cryptomanager.com/tv.html                                          
    s = State(0x752878397493CB70)
    @assert3f hex encrypt(s, 0x1122334455667788) == 0xB5219EE81AA7499D

which produces output:

    ERROR: Assertion failed: 8721fdc137e0d2c0 [!==] b5219ee81aa7499d

(which is much more useful, IMHO).

Code is at 
https://github.com/andrewcooke/BlockCipherSelfStudy.jl/blob/master/src/Assert.jl
 
but you'll need to cut + paste as it's part of a larger package not 
intended for public use.

Cheers,
Andrew


Reply via email to