def test_fscanf(self):
    create_test_file('three_numbers.txt', '-1 0.1 -.1')
    src = '\n      #include <stdio.h>\n      #include <assert.h>\n      #include <float.h>\n      int main()\n      {\n          float x = FLT_MAX, y = FLT_MAX, z = FLT_MAX;\n\n          FILE* fp = fopen("three_numbers.txt", "r");\n          if (fp) {\n              int match = fscanf(fp, " %f %f %f ", &x, &y, &z);\n              printf("match = %d\\n", match);\n              printf("x = %0.1f, y = %0.1f, z = %0.1f\\n", x, y, z);\n          } else {\n              printf("failed to open three_numbers.txt\\n");\n          }\n          return 0;\n      }\n    '
    self.emcc_args += ['--embed-file', 'three_numbers.txt']
    self.do_run(src, 'match = 3\nx = -1.0, y = 0.1, z = -0.1\n')
def test_fscanf(self):
    create_test_file('three_numbers.txt', '-1 0.1 -.1')
    src = '\n      #include <stdio.h>\n      #include <assert.h>\n      #include <float.h>\n      int main()\n      {\n          float x = FLT_MAX, y = FLT_MAX, z = FLT_MAX;\n\n          FILE* fp = fopen("three_numbers.txt", "r");\n          if (fp) {\n              int match = fscanf(fp, " %f %f %f ", &x, &y, &z);\n              printf("match = %d\\n", match);\n              printf("x = %0.1f, y = %0.1f, z = %0.1f\\n", x, y, z);\n          } else {\n              printf("failed to open three_numbers.txt\\n");\n          }\n          return 0;\n      }\n    '
    self.emcc_args += ['--embed-file', 'three_numbers.txt']
    self.do_run(src, 'match = 3\nx = -1.0, y = 0.1, z = -0.1\n')