3 * Test rig for bits header
5 * (c) 2000 Straylight/Edgeware
8 /*----- Licensing notice --------------------------------------------------*
10 * This file is part of the mLib utilities library.
12 * mLib is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Library General Public License as
14 * published by the Free Software Foundation; either version 2 of the
15 * License, or (at your option) any later version.
17 * mLib is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with mLib; if not, write to the Free
24 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
28 /*----- Header files ------------------------------------------------------*/
33 /*----- Main code ---------------------------------------------------------*/
37 static int t##OP(dstr *v) \
40 unsigned s = *(unsigned *)v[1].buf; \
43 LOAD64_(x, v[0].buf); \
44 LOAD64_(xx, v[2].buf); \
47 if (CMP64(y, !=, xx)) { \
50 "\nbad: %08x:%08x " #OP " %u != %08x:%08x [%08x:%08x]\n", \
51 HI64(x), LO64(x), s, HI64(y), LO64(y), HI64(xx), LO64(xx)); \
58 static int t##OP(dstr *v) \
60 kludge64 x, y, xx, yy; \
63 LOAD64_(x, v[0].buf); \
64 LOAD64_(y, v[1].buf); \
65 LOAD64_(xx, v[2].buf); \
68 if (CMP64(yy, !=, xx)) { \
71 "\nbad: %08x:%08x " #OP " %08x:%08x != %08x:%08x " \
73 HI64(x), LO64(x), HI64(y), LO64(y), \
74 HI64(yy), LO64(yy), HI64(xx), LO64(xx)); \
86 static test_chunk tests
[] = {
87 { "lsl64", tLSL
, { &type_hex
, &type_int
, &type_hex
, 0 } },
88 { "lsr64", tLSR
, { &type_hex
, &type_int
, &type_hex
, 0 } },
89 { "rol64", tROL
, { &type_hex
, &type_int
, &type_hex
, 0 } },
90 { "ror64", tROR
, { &type_hex
, &type_int
, &type_hex
, 0 } },
91 { "add64", tADD
, { &type_hex
, &type_hex
, &type_hex
, 0 } },
92 { "sub64", tSUB
, { &type_hex
, &type_hex
, &type_hex
, 0 } },
96 int main(int argc
, char *argv
[])
98 test_run(argc
, argv
, tests
, SRCDIR
"/t/bits.tests");
102 /*----- That's all, folks -------------------------------------------------*/