def test_unsigned(self):
    src = '\n      #include <stdio.h>\n      const signed char cvals[2] = { -1, -2 }; // compiler can store this is a string, so -1 becomes \\FF, and needs re-signing\n      int main()\n      {\n        {\n          unsigned char x = 200;\n          printf("*%d*\\n", x);\n          unsigned char y = -22;\n          printf("*%d*\\n", y);\n        }\n\n        int varey = 100;\n        unsigned int MAXEY = -1, MAXEY2 = -77;\n        printf("*%u,%d,%u*\\n", MAXEY, varey >= MAXEY, MAXEY2); // 100 >= -1? not in unsigned!\n\n        int y = cvals[0];\n        printf("*%d,%d,%d,%d*\\n", cvals[0], cvals[0] < 0, y, y < 0);\n        y = cvals[1];\n        printf("*%d,%d,%d,%d*\\n", cvals[1], cvals[1] < 0, y, y < 0);\n\n        // zext issue - see mathop in jsifier\n        unsigned char x8 = -10;\n        unsigned long hold = 0;\n        hold += x8;\n        int y32 = hold+50;\n        printf("*%u,%u*\\n", hold, y32);\n\n        // Comparisons\n        x8 = 0;\n        for (int i = 0; i < 254; i++) x8++; // make it an actual 254 in JS - not a -2\n        printf("*%d,%d*\\n", x8+1 == 0xff, x8+1 != 0xff); // 0xff may be \'-1\' in the bitcode\n\n        return 0;\n      }\n    '
    self.do_run(src, '*4294967295,0,4294967219*\n*-1,1,-1,1*\n*-2,1,-2,1*\n*246,296*\n*1,0*')
    self.emcc_args.append('-Wno-constant-conversion')
    src = '\n      #include <stdio.h>\n      int main()\n      {\n        {\n          unsigned char x;\n          unsigned char *y = &x;\n          *y = -1;\n          printf("*%d*\\n", x);\n        }\n        {\n          unsigned short x;\n          unsigned short *y = &x;\n          *y = -1;\n          printf("*%d*\\n", x);\n        }\n        /*{ // This case is not checked. The hint for unsignedness is just the %u in printf, and we do not analyze that\n          unsigned int x;\n          unsigned int *y = &x;\n          *y = -1;\n          printf("*%u*\\n", x);\n        }*/\n        {\n          char x;\n          char *y = &x;\n          *y = 255;\n          printf("*%d*\\n", x);\n        }\n        {\n          char x;\n          char *y = &x;\n          *y = 65535;\n          printf("*%d*\\n", x);\n        }\n        {\n          char x;\n          char *y = &x;\n          *y = 0xffffffff;\n          printf("*%d*\\n", x);\n        }\n        return 0;\n      }\n    '
    self.do_run(src, '*255*\n*65535*\n*-1*\n*-1*\n*-1*')
def test_unsigned(self):
    src = '\n      #include <stdio.h>\n      const signed char cvals[2] = { -1, -2 }; // compiler can store this is a string, so -1 becomes \\FF, and needs re-signing\n      int main()\n      {\n        {\n          unsigned char x = 200;\n          printf("*%d*\\n", x);\n          unsigned char y = -22;\n          printf("*%d*\\n", y);\n        }\n\n        int varey = 100;\n        unsigned int MAXEY = -1, MAXEY2 = -77;\n        printf("*%u,%d,%u*\\n", MAXEY, varey >= MAXEY, MAXEY2); // 100 >= -1? not in unsigned!\n\n        int y = cvals[0];\n        printf("*%d,%d,%d,%d*\\n", cvals[0], cvals[0] < 0, y, y < 0);\n        y = cvals[1];\n        printf("*%d,%d,%d,%d*\\n", cvals[1], cvals[1] < 0, y, y < 0);\n\n        // zext issue - see mathop in jsifier\n        unsigned char x8 = -10;\n        unsigned long hold = 0;\n        hold += x8;\n        int y32 = hold+50;\n        printf("*%u,%u*\\n", hold, y32);\n\n        // Comparisons\n        x8 = 0;\n        for (int i = 0; i < 254; i++) x8++; // make it an actual 254 in JS - not a -2\n        printf("*%d,%d*\\n", x8+1 == 0xff, x8+1 != 0xff); // 0xff may be \'-1\' in the bitcode\n\n        return 0;\n      }\n    '
    self.do_run(src, '*4294967295,0,4294967219*\n*-1,1,-1,1*\n*-2,1,-2,1*\n*246,296*\n*1,0*')
    self.emcc_args.append('-Wno-constant-conversion')
    src = '\n      #include <stdio.h>\n      int main()\n      {\n        {\n          unsigned char x;\n          unsigned char *y = &x;\n          *y = -1;\n          printf("*%d*\\n", x);\n        }\n        {\n          unsigned short x;\n          unsigned short *y = &x;\n          *y = -1;\n          printf("*%d*\\n", x);\n        }\n        /*{ // This case is not checked. The hint for unsignedness is just the %u in printf, and we do not analyze that\n          unsigned int x;\n          unsigned int *y = &x;\n          *y = -1;\n          printf("*%u*\\n", x);\n        }*/\n        {\n          char x;\n          char *y = &x;\n          *y = 255;\n          printf("*%d*\\n", x);\n        }\n        {\n          char x;\n          char *y = &x;\n          *y = 65535;\n          printf("*%d*\\n", x);\n        }\n        {\n          char x;\n          char *y = &x;\n          *y = 0xffffffff;\n          printf("*%d*\\n", x);\n        }\n        return 0;\n      }\n    '
    self.do_run(src, '*255*\n*65535*\n*-1*\n*-1*\n*-1*')