@@ -21,6 +21,12 @@ _Static_assert(CHAR_BIT == 8, "Buffers passed to fmemopen presume 8 bit chars");
2121static int successes = 0 ;
2222static int failures = 0 ;
2323
24+ static void fprint_cmr (FILE * stream , const uint32_t * cmr ) {
25+ fprintf (stream , "0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x" ,
26+ cmr [0 ], cmr [1 ], cmr [2 ], cmr [3 ], cmr [4 ], cmr [5 ], cmr [6 ], cmr [7 ]
27+ );
28+ }
29+
2430static void test_decodeUptoMaxInt (void ) {
2531 printf ("Test decodeUptoMaxInt\n" );
2632 const unsigned char buf [] =
@@ -193,7 +199,11 @@ static void test_program(char* name, const unsigned char* program, size_t progra
193199 successes ++ ;
194200 } else {
195201 failures ++ ;
196- printf ("Unexpected CMR.\n" );
202+ printf ("Unexpected CMR. Expected\n{" );
203+ fprint_cmr (stdout , expectedCMR );
204+ printf ("}, but received\n{" );
205+ fprint_cmr (stdout , dag [len - 1 ].cmr .s );
206+ printf ("}\n" );
197207 }
198208 }
199209 type * type_dag ;
@@ -506,10 +516,13 @@ static void regression_tests(void) {
506516 /* word("2^23 zero bits") ; unit */
507517 size_t sizeof_regression3 = ((size_t )1 << 20 ) + 4 ;
508518 unsigned char * regression3 = calloc (sizeof_regression3 , 1 );
519+ const uint32_t cmr [] = {
520+ 0x7f81c076u , 0xf0df9505u , 0xbfce61f0u , 0x41197bd9u , 0x2aaaa4f1u , 0x7015d1ecu , 0xb248ddffu , 0xe9d9da07u
521+ };
509522 assert (regression3 );
510523 regression3 [0 ] = 0xb7 ; regression3 [1 ] = 0x08 ;
511524 regression3 [sizeof_regression3 - 2 ] = 0x48 ; regression3 [sizeof_regression3 - 1 ] = 0x20 ;
512- test_program ("regression3" , regression3 , sizeof_regression3 , SIMPLICITY_ERR_EXEC_MEMORY , NULL , NULL , NULL , NULL );
525+ test_program ("regression3" , regression3 , sizeof_regression3 , SIMPLICITY_ERR_EXEC_MEMORY , cmr , NULL , NULL , NULL );
513526 free (regression3 );
514527 }
515528}
0 commit comments