Skip to content

Commit

Permalink
fix detect encodings
Browse files Browse the repository at this point in the history
  • Loading branch information
lemire committed Apr 9, 2024
1 parent c9e9d51 commit 972b944
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/detect_encodings_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ TEST(pure_utf16_ASCII) {
auto actual = implementation.detect_encodings(
reinterpret_cast<const char *>(generated.data()),
size);
ASSERT_TRUE(actual == expected);
ASSERT_TRUE((actual & expected) == expected); // Must be at least UTF8 and UTF16_LE.
}
}
}
Expand All @@ -91,7 +91,7 @@ TEST(pure_utf32_ASCII) {
auto actual = implementation.detect_encodings(
reinterpret_cast<const char *>(generated.data()),
size);
ASSERT_TRUE(actual == expected);
ASSERT_TRUE((actual & expected) == expected); // Must be at least UTF8 and UTF16_LE and UTF32_LE.
}
}
}
Expand Down Expand Up @@ -119,7 +119,7 @@ TEST(no_utf8_bytes_no_surrogates) {
auto actual = implementation.detect_encodings(
reinterpret_cast<const char *>(generated.data()),
size);
ASSERT_TRUE(actual == expected);
ASSERT_TRUE((actual & expected) == expected); // Must be at least UTF16_LE and UTF32_LE.
}
}
}
Expand Down Expand Up @@ -149,7 +149,7 @@ TEST(two_utf8_bytes) {
std::cout << "failed to detect valid UTF-16LE." << std::endl;
}
}
ASSERT_TRUE(actual == expected);
ASSERT_TRUE((actual & expected) == expected); // Must be at least UTF8 and UTF16_LE.
}
}
}
Expand All @@ -170,7 +170,7 @@ TEST(utf_16_surrogates) {
auto actual = implementation.detect_encodings(
reinterpret_cast<const char *>(generated.first.data()),
size);
ASSERT_TRUE(actual == expected);
ASSERT_TRUE((actual & expected) == expected); // Must be at least UTF16_LE.
}
}
}
Expand Down Expand Up @@ -198,7 +198,7 @@ TEST(utf32_surrogates) {
auto actual = implementation.detect_encodings(
reinterpret_cast<const char *>(generated.data()),
size);
ASSERT_TRUE(actual == expected);
ASSERT_TRUE((actual & expected) == expected); // Must be at least UTF32_LE.
}
}
}
Expand Down Expand Up @@ -233,7 +233,7 @@ TEST(edge_surrogate) {
auto actual = implementation.detect_encodings(
reinterpret_cast<const char *>(generated.data()),
size);
ASSERT_TRUE(actual == expected);
ASSERT_TRUE((actual & expected) == expected); // Must be at least UTF16_LE.
}
}
#endif
Expand All @@ -254,7 +254,7 @@ TEST(tail_utf8) {
auto actual = implementation.detect_encodings(
reinterpret_cast<const char *>(generated.first.data()),
size);
ASSERT_TRUE(actual == expected);
ASSERT_TRUE((actual & expected) == expected); // Must be at least UTF8 and UTF16_LE.
}
}
}
Expand Down

0 comments on commit 972b944

Please sign in to comment.