def test_sscanf_2(self):
    for ftype in ['float', 'double']:
        src = '\n          #include <stdio.h>\n\n          int main(){\n              char strval1[] = "1.2345678901";\n              char strval2[] = "1.23456789e5";\n              char strval3[] = "1.23456789E5";\n              char strval4[] = "1.2345678e-5";\n              char strval5[] = "1.2345678E-5";\n              double dblval = 1.2345678901;\n              double tstval;\n\n              sscanf(strval1, "%lf", &tstval);\n              if(dblval != tstval) printf("FAIL: Values are not equal: %lf %lf\\n", dblval, tstval);\n              else printf("Pass: %lf %lf\\n", tstval, dblval);\n\n              sscanf(strval2, "%lf", &tstval);\n              dblval = 123456.789;\n              if(dblval != tstval) printf("FAIL: Values are not equal: %lf %lf\\n", dblval, tstval);\n              else printf("Pass: %lf %lf\\n", tstval, dblval);\n\n              sscanf(strval3, "%lf", &tstval);\n              dblval = 123456.789;\n              if(dblval != tstval) printf("FAIL: Values are not equal: %lf %lf\\n", dblval, tstval);\n              else printf("Pass: %lf %lf\\n", tstval, dblval);\n\n              sscanf(strval4, "%lf", &tstval);\n              dblval = 0.000012345678;\n              if(dblval != tstval) printf("FAIL: Values are not equal: %lf %lf\\n", dblval, tstval);\n              else printf("Pass: %lf %lf\\n", tstval, dblval);\n\n              sscanf(strval5, "%lf", &tstval);\n              dblval = 0.000012345678;\n              if(dblval != tstval) printf("FAIL: Values are not equal: %lf %lf\\n", dblval, tstval);\n              else printf("Pass: %lf %lf\\n", tstval, dblval);\n\n              return 0;\n          }\n        '
        if (ftype == 'float'):
            self.do_run(src.replace('%lf', '%f').replace('double', 'float'), 'Pass: 1.234568 1.234568\nPass: 123456.789062 123456.789062\nPass: 123456.789062 123456.789062\nPass: 0.000012 0.000012\nPass: 0.000012 0.000012')
        else:
            self.do_run(src, 'Pass: 1.234568 1.234568\nPass: 123456.789000 123456.789000\nPass: 123456.789000 123456.789000\nPass: 0.000012 0.000012\nPass: 0.000012 0.000012')
def test_sscanf_2(self):
    for ftype in ['float', 'double']:
        src = '\n          #include <stdio.h>\n\n          int main(){\n              char strval1[] = "1.2345678901";\n              char strval2[] = "1.23456789e5";\n              char strval3[] = "1.23456789E5";\n              char strval4[] = "1.2345678e-5";\n              char strval5[] = "1.2345678E-5";\n              double dblval = 1.2345678901;\n              double tstval;\n\n              sscanf(strval1, "%lf", &tstval);\n              if(dblval != tstval) printf("FAIL: Values are not equal: %lf %lf\\n", dblval, tstval);\n              else printf("Pass: %lf %lf\\n", tstval, dblval);\n\n              sscanf(strval2, "%lf", &tstval);\n              dblval = 123456.789;\n              if(dblval != tstval) printf("FAIL: Values are not equal: %lf %lf\\n", dblval, tstval);\n              else printf("Pass: %lf %lf\\n", tstval, dblval);\n\n              sscanf(strval3, "%lf", &tstval);\n              dblval = 123456.789;\n              if(dblval != tstval) printf("FAIL: Values are not equal: %lf %lf\\n", dblval, tstval);\n              else printf("Pass: %lf %lf\\n", tstval, dblval);\n\n              sscanf(strval4, "%lf", &tstval);\n              dblval = 0.000012345678;\n              if(dblval != tstval) printf("FAIL: Values are not equal: %lf %lf\\n", dblval, tstval);\n              else printf("Pass: %lf %lf\\n", tstval, dblval);\n\n              sscanf(strval5, "%lf", &tstval);\n              dblval = 0.000012345678;\n              if(dblval != tstval) printf("FAIL: Values are not equal: %lf %lf\\n", dblval, tstval);\n              else printf("Pass: %lf %lf\\n", tstval, dblval);\n\n              return 0;\n          }\n        '
        if (ftype == 'float'):
            self.do_run(src.replace('%lf', '%f').replace('double', 'float'), 'Pass: 1.234568 1.234568\nPass: 123456.789062 123456.789062\nPass: 123456.789062 123456.789062\nPass: 0.000012 0.000012\nPass: 0.000012 0.000012')
        else:
            self.do_run(src, 'Pass: 1.234568 1.234568\nPass: 123456.789000 123456.789000\nPass: 123456.789000 123456.789000\nPass: 0.000012 0.000012\nPass: 0.000012 0.000012')