MCPcopy Create free account
hub / github.com/bytedance/sonic-cpp / ParseFloatInFiles

Function ParseFloatInFiles

tests/parsenumber_test.cpp:122–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122void ParseFloatInFiles() {
123 std::vector<std::string> files = {"./testdata/num/float-1.txt",
124 "./testdata/num/float-8.txt"};
125
126 for (auto& f : files) {
127 std::ifstream is(f);
128 if (is.is_open()) {
129 std::string number;
130 while (std::getline(is, number)) {
131 if (number.size() > 0 && number[0] != '#' && number[0] != '\n' &&
132 number[0] != '\t' && number[0] != '\b') {
133 double df = std::atof(number.c_str());
134 TestParseDouble(df, number.c_str());
135 }
136 }
137 } else {
138 std::cout << "Error open files: " << f << std::endl;
139 }
140 is.close();
141 }
142}
143
144TEST(ParserTest, ParseTestData) { ParseFloatInFiles(); }
145

Callers 1

TESTFunction · 0.85

Calls 1

TestParseDoubleFunction · 0.85

Tested by

no test coverage detected