cleanup: Big pile of whitespace fixes, all at once.
[u/mdw/catacomb] / tests / mpx
index eee85b6..e30e91a 100644 (file)
--- a/tests/mpx
+++ b/tests/mpx
@@ -1,6 +1,6 @@
 # Test vectors for low-level MP functions
 #
-# $Id: mpx,v 1.5 2000/06/17 12:11:39 mdw Exp $
+# $Id: mpx,v 1.12 2004/04/01 12:50:41 mdw Exp $
 
 # --- Load-store tests ---
 #
@@ -20,15 +20,42 @@ load-store {
   522f8b1de257972a25ec49c9ff56340e2684e847ef2fa4d5714d7c8d454e90f6;
 }
 
+# --- Two's complement tests ---
+
+2cb {
+  "" "";
+  00 00;
+  000000 00000000000000000000;
+  01 ff;
+  0123456789abcdef fedcba9876543211;
+  0123456789abcdef fffffffedcba9876543211;
+  0100000000 ffffff00000000;
+  00000000c1a4bc4b ffffffff3e5b43b5;
+  ffffffff3e5b43b5 00000000c1a4bc4b;
+}
+
+2cl {
+  "" "";
+  00 00;
+  000000 00000000000000000000;
+  01 ff;
+  efcdab8967452301 1132547698badcfe;
+  efcdab8967452301 1132547698badcfeffffffff;
+  0000000001 00000000ffffffff;
+  4bbca4c100000000 b5435b3effffffff;
+  b5435b3effffffff 4bbca4c100000000;
+}
+
 # --- Shift tests ---
 
 lsl {
-
   # --- Simple sanity checks ---
 
   01 2 04;
   01 4 10;
 
+  7 -1 0;
+
   # --- Copy shifts ---
 
   01 0 01;
@@ -107,12 +134,99 @@ lsl {
   0e0dd2bb4d1e654846356309a2d97fee00000000;
 }
 
-lsr {
+lslc {
+  # --- Simple sanity checks ---
+
+  01 2 07;
+  01 4 1f;
+
+  7 -1 0;
+
+  # --- Copy shifts ---
+
+  01 0 01;
+  0123456789abcdef0123456789abcdef 0 0123456789abcdef0123456789abcdef;
+
+  # --- Single bit shifts ---
+
+  01 1 03;
+  ff000000 1 01fe000001;
+
+  # --- Word-size shifts (assumes 32-bit words) ---
+
+  0123456789abcdef0123456789abcdef 32
+  0123456789abcdef0123456789abcdefffffffff;
+
+  # --- Random tests ---
+
+  13bbec3a734e0b8b5155600b0826b913 90
+  4eefb0e9cd382e2d4555802c209ae44fffffffffffffffffffffff;
+
+  d6ca6a99fe49b256f80e9643e2bd4f3e 80
+  d6ca6a99fe49b256f80e9643e2bd4f3effffffffffffffffffff;
+
+  c94784b40d54de614084915915531ddc 59
+  064a3c25a06aa6f30a04248ac8aa98eee7ffffffffffffff;
+
+  a63c314a39cc37f950b3d530c95ead00 84
+  0a63c314a39cc37f950b3d530c95ead00fffffffffffffffffffff;
+
+  842d03a339f5004cfd311e2bb23216ac 62
+  210b40e8ce7d40133f4c478aec8c85ab3fffffffffffffff;
+
+  9a8e659739bf9ee7aa908b7c058c5e7e 123
+  04d4732cb9cdfcf73d54845be02c62f3f7ffffffffffffffffffffffffffffff;
+
+  287f5774f212db87bcd83a1bbb7b1ad5 6
+  0a1fd5dd3c84b6e1ef360e86eedec6b57f;
+
+  ec1739174d9d4438d3093cf378605a5c 63
+  760b9c8ba6cea21c69849e79bc302d2e7fffffffffffffff;
+
+  3dfa8ad6a60a783639d05aa5fbfd993d 46
+  0f7ea2b5a9829e0d8e7416a97eff664f7fffffffffff;
+
+  e4e93a80b6d25b34c23aca3a0d06d76c 63
+  72749d405b692d9a611d651d06836bb67fffffffffffffff;
+
+  5a4cf5becb4b64a1a31637c91b6415fd 102
+  16933d6fb2d2d92868c58df246d9057f7fffffffffffffffffffffffff;
+
+  d92f60928b67416c1e20bd9e09026115 69
+  1b25ec12516ce82d83c417b3c1204c22bfffffffffffffffff;
+
+  eae78f56200d7734f7eb68479fe09d51 18
+  03ab9e3d588035dcd3dfada11e7f827547ffff;
+
+  4c9c215ead951513d969d66614016f6e 28
+  04c9c215ead951513d969d66614016f6efffffff;
+
+  5cb1e4d625eac0393644fe6a7e3ff788 33
+  b963c9ac4bd580726c89fcd4fc7fef11ffffffff;
 
+  68b23795968766c77b1897c88a5d6ba8 78
+  1a2c8de565a1d9b1dec625f222975aea3fffffffffffffffffff;
+
+  3d96cd168c74f9015afb691d629f3f6d 72
+  3d96cd168c74f9015afb691d629f3f6dffffffffffffffffff;
+
+  38fa8f63dc426399e0f9b5c01231e02c 95
+  1c7d47b1ee2131ccf07cdae00918f0167fffffffffffffffffffffff;
+
+  90176b493061899ec95677ccc58b8cdf 78
+  2405dad24c186267b2559df33162e337ffffffffffffffffffff;
+
+  0706e95da68f32a4231ab184d16cbff7 33
+  0e0dd2bb4d1e654846356309a2d97fefffffffff;
+}
+
+lsr {
   # --- Simple sanity checks ---
 
   04 2 01;
   10 4 01;
+  7 -1 0;
+  7 32 0;
 
   # --- Copy shifts ---
 
@@ -205,15 +319,15 @@ uadd {
 
   00 00 00;
   00 01 01;
-  01 00 01;  
+  01 00 01;
 
   # --- Carry propagation tests ---
 
     ffffffffffffffffffffffffffffffffffffffffffffffffffffffff
-                                                          01
+                                                         01
   0100000000000000000000000000000000000000000000000000000000;
 
-                                                          01
+                                                         01
     ffffffffffffffffffffffffffffffffffffffffffffffffffffffff
   0100000000000000000000000000000000000000000000000000000000;
 
@@ -410,7 +524,7 @@ umul {
   45 01 45;
 
   # --- Random tests ---
-  
+
   4162c300b3e157e9cd1301d499c20121
   10549901fc6dcb85882440087bd398ff
   042bc7ac8fe08ceefb098f286cdd84fd037906ead144324e361c488a221db7df;
@@ -493,7 +607,7 @@ umul {
 
   # --- Karatsuba regression ---
   #
-  # This bug was caused by kmul (a) choosing the split point too low on 
+  # This bug was caused by kmul (a) choosing the split point too low on
   # odd-sized inputs and (b) not allocating enough workspace.
 
   21a9269d7b8b63cf18faa933b3c868ba1e8cb3f00b57e197709abf96eeb9bf12e8fe22b3
@@ -760,4 +874,17 @@ udiv {
   620d87bb63872a40fc2092b0ed7d3ec4b648be41
   0155177e99a8a5113226ff8270
   2ea2205327e66d75990cc999fc2380883ee4591a;
+
+  # --- Bugs ---
+
+  1a923b3406cbe81b093ce418f6a73107f504502b2e3d1b200762fcf6062723de405cab0aea00000000000000000000000000000000
+  184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000
+  0117d3db34ad005954459be9abedd0e5deb4ea0000000000000000
+  00;
+
+  ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff
+  7fffffffffffffffe487ed5110b4611a62633145c06e0e68948127044533e63a0105df531d89cd9128a5043cc71a026ef7ca8cd9e69d218d98158536f92f8a1ba7f09ab6b6a8e122f242dabb312f3f637a262174d31d1b107fffffffffffffff
+  02 01;
+
+  26737e 0ffffc 02 067386;
 }