tests/common/124: Print an error when square fails

Otherwise we can't know why it failed and that makes it harder to debug.
pull/1184/head
Nirbheek Chauhan 8 years ago
parent 5240688f5c
commit 4967b2a5ea
  1. 9
      test cases/common/126 llvm ir and assembly/main.c
  2. 8
      test cases/common/126 llvm ir and assembly/main.cpp

@ -1,9 +1,14 @@
#include <stdio.h>
unsigned square_unsigned (unsigned a); unsigned square_unsigned (unsigned a);
int int
main (int argc, char * argv[]) main (int argc, char * argv[])
{ {
if (square_unsigned (2) != 4) unsigned int ret = square_unsigned (2);
return -1; if (ret != 4) {
printf("Got %u instead of 4\n", ret);
return 1;
}
return 0; return 0;
} }

@ -1,3 +1,4 @@
#include <stdio.h>
extern "C" { extern "C" {
unsigned square_unsigned (unsigned a); unsigned square_unsigned (unsigned a);
@ -6,7 +7,10 @@ extern "C" {
int int
main (int argc, char * argv[]) main (int argc, char * argv[])
{ {
if (square_unsigned (2) != 4) unsigned int ret = square_unsigned (2);
return -1; if (ret != 4) {
printf("Got %u instead of 4\n", ret);
return 1;
}
return 0; return 0;
} }

Loading…
Cancel
Save