X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/ba6e6b64033b1f9de49feccb5c9cd438354481f7..0f00dc4c8eb47e67bc0f148c2dd109f73a451e0a:/math/t/mpint diff --git a/math/t/mpint b/math/t/mpint new file mode 100644 index 0000000..9c3263d --- /dev/null +++ b/math/t/mpint @@ -0,0 +1,50 @@ +# Test vectors for conversion between MP ints and C ints +# +# The tests look messy because I'm fighting with atoi here as well as the +# integer conversion routines I'm trying to test. + +fromuint { + 0 0; + 1 1; + -5 0xfffffffb; + 0x7ffff 0x7ffff; + 0x80000 0x80000; + 0xfffff 0xfffff; + 0x7fffffff 0x7fffffff; + 0x80000000 0x80000000; # Bastard torture test + 0xffffffff 0xffffffff; +} + +fromint { + 0 0; + 1 1; + -5 -5; + 0x7ffff 0x7ffff; + 0x80000 0x80000; + 0xfffff 0xfffff; + 0x7fffffff 0x7fffffff; + -0x80000000 -0x80000000; # Bastard torture test +} + +touint { + 0 0; + 1 1; + -5 -5; + 0x7ffff 0x7ffff; + 0x80000 0x80000; + 0xfffff 0xfffff; + 0x7fffffff 0x7fffffff; + 0x80000000 -0x80000000; # Bastard torture test + 0xffffffff 0xffffffff; +} + +toint { + 0 0; + 1 1; + -5 -5; + 0x7ffff 0x7ffff; + 0x80000 0x80000; + 0xfffff 0xfffff; + 0x7fffffff 0x7fffffff; + -0x80000000 -0x80000000; # Bastard torture test +}