1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#include "simdutf.h"
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
namespace {
using simdutf::tests::helpers::transcode_utf8_to_utf16_test_base;
} // namespace
TEST_LOOP(convert_all_latin1) {
size_t counter = 0;
auto generator = [&counter]() -> uint32_t { return counter++ & 0xFF; };
auto procedure = [&implementation](const char *latin1, size_t size,
char32_t *utf32) -> size_t {
return implementation.convert_latin1_to_utf32(latin1, size, utf32);
};
auto size_procedure =
[&implementation](simdutf_maybe_unused const char *latin1,
size_t size) -> size_t {
return implementation.utf32_length_from_latin1(size);
};
// Check varying length inputs for upto 16 bytes
for (size_t i = 240; i <= 256; i++) {
simdutf::tests::helpers::transcode_latin1_to_utf32_test_base test(generator,
i);
ASSERT_TRUE(test(procedure));
ASSERT_TRUE(test.check_size(size_procedure));
}
}
TEST_MAIN
|