[libc-commits] [libc] [libc][test] make `str_to_float_comparison_test` independent of C++ headers. (PR #133978)
Muhammad Bassiouni via libc-commits
libc-commits at lists.llvm.org
Tue Apr 1 16:25:19 PDT 2025
================
@@ -150,24 +149,23 @@ int main(int argc, char *argv[]) {
int detailedBitDiffs[4] = {0, 0, 0, 0};
int total = 0;
- for (int i = 1; i < argc; i++) {
- std::cout << "Starting file " << argv[i] << "\n";
- int curResult =
- checkFile(argv[i], &fails, &bitdiffs, detailedBitDiffs, &total);
- if (curResult == 1) {
- result = 1;
- break;
- } else if (curResult == 2) {
- result = 2;
- }
+
+ char filename[] = "str_to_float_comparison_data.txt";
+ LIBC_NAMESPACE::printf("Starting file %s\n", filename);
+ int curResult =
+ checkFile(filename, &fails, &bitdiffs, detailedBitDiffs, &total);
+ if (curResult == 1) {
+ result = 1;
+ } else if (curResult == 2) {
+ result = 2;
}
- std::cout << "Results:\n"
- << "Total significant failed conversions: " << fails << "\n"
- << "Total conversions off by +/- 1 bit: " << bitdiffs << "\n"
- << "\t" << detailedBitDiffs[0] << "\tfloat low\n"
- << "\t" << detailedBitDiffs[1] << "\tfloat high\n"
- << "\t" << detailedBitDiffs[2] << "\tdouble low\n"
- << "\t" << detailedBitDiffs[3] << "\tdouble high\n"
- << "Total lines: " << total << "\n";
- return result;
+
+ EXPECT_EQ(result, 0);
+ EXPECT_EQ(fails, 0);
+ EXPECT_EQ(bitdiffs, 0);
+ EXPECT_EQ(detailedBitDiffs[0], 0);
+ EXPECT_EQ(detailedBitDiffs[1], 0);
+ EXPECT_EQ(detailedBitDiffs[2], 0);
+ EXPECT_EQ(detailedBitDiffs[3], 0);
----------------
bassiounix wrote:
could you elaborate on what are those? I don't know what you mean.
https://github.com/llvm/llvm-project/pull/133978
More information about the libc-commits
mailing list