Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: remove unnecessary includes #409

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions tests/base64_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

#include <array>

#include <memory>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
#include <tests/helpers/transcode_test_base.h>

// We may disable base64url tests by commenting out this next line.
#define SIMDUTF_BASE64URL_TESTS 1
Expand Down
3 changes: 0 additions & 3 deletions tests/basic_fuzzer.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#include "simdutf.h"

#include <array>
#include <fstream>
#include <stdexcept>
#include <random>
#include <string>
#include <memory>

#include <tests/reference/encode_utf8.h>
Expand Down
5 changes: 1 addition & 4 deletions tests/bele_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ TEST(convert_utf16be_to_utf8) {
}
}


TEST(convert_utf16be_to_utf32) {
char32_t buffer[utf32_size];
size_t count = implementation.convert_utf16be_to_utf32(utf16be, utf16_size, buffer);
Expand All @@ -163,6 +162,4 @@ TEST(convert_utf16be_to_utf32) {
}
}

int main(int argc, char* argv[]) {
return simdutf::test::main(argc, argv);
}
TEST_MAIN
2 changes: 0 additions & 2 deletions tests/convert_latin1_to_utf16be_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include <array>

#include <tests/reference/validate_utf32.h>
#include <tests/reference/decode_utf32.h>
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
Expand Down
2 changes: 0 additions & 2 deletions tests/convert_latin1_to_utf16le_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include <array>

#include <tests/reference/validate_utf32.h>
#include <tests/reference/decode_utf32.h>
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
Expand Down
3 changes: 0 additions & 3 deletions tests/convert_latin1_to_utf32_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#include "simdutf.h"

#include <array>

#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
#include <memory>

namespace {
using simdutf::tests::helpers::transcode_utf8_to_utf16_test_base;
Expand Down
2 changes: 0 additions & 2 deletions tests/convert_latin1_to_utf8_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
#include <array>

#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
#include <memory>

namespace {
using simdutf::tests::helpers::transcode_utf8_to_utf16_test_base;
Expand Down
6 changes: 1 addition & 5 deletions tests/convert_utf16be_to_latin1_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@

#include <array>

#include <tests/reference/validate_utf16.h>
#include <tests/reference/decode_utf16.h>
#include <tests/reference/validate_utf16_to_latin1.h>
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>

#include "reference/validate_utf16_to_latin1.h"


namespace {
std::array<size_t, 7> input_size{7, 16, 12, 64, 67, 128, 256};
Expand All @@ -19,7 +16,6 @@ namespace {
constexpr int trials = 1000;
}


// For invalid inputs, we expect the conversion to fail (return 0)
TEST_LOOP(trials, convert_random_inputs) {
simdutf::tests::helpers::RandomInt r(0x00, 0xffff, seed);
Expand Down
1 change: 0 additions & 1 deletion tests/convert_utf16be_to_utf32_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <array>

#include <tests/reference/validate_utf16.h>
#include <tests/reference/decode_utf16.h>
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
Expand Down
2 changes: 0 additions & 2 deletions tests/convert_utf16be_to_utf32_with_errors_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include <array>

#include <tests/reference/validate_utf16.h>
#include <tests/reference/decode_utf16.h>
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
Expand Down
1 change: 0 additions & 1 deletion tests/convert_utf16be_to_utf8_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <array>

#include <tests/reference/validate_utf16.h>
#include <tests/reference/decode_utf16.h>
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
Expand Down
2 changes: 0 additions & 2 deletions tests/convert_utf16be_to_utf8_with_errors_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include <array>

#include <tests/reference/validate_utf16.h>
#include <tests/reference/decode_utf16.h>
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
Expand Down
5 changes: 1 addition & 4 deletions tests/convert_utf16le_to_latin1_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@

#include <array>

#include <tests/reference/validate_utf16.h>
#include <tests/reference/decode_utf16.h>
#include <tests/reference/validate_utf16_to_latin1.h>
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>

#include "reference/validate_utf16_to_latin1.h"


namespace {
std::array<size_t, 7> input_size{7, 16, 12, 64, 67, 128, 256};
Expand Down
1 change: 0 additions & 1 deletion tests/convert_utf16le_to_utf32_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <array>

#include <tests/reference/validate_utf16.h>
#include <tests/reference/decode_utf16.h>
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
Expand Down
2 changes: 0 additions & 2 deletions tests/convert_utf16le_to_utf32_with_errors_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include <array>

#include <tests/reference/validate_utf16.h>
#include <tests/reference/decode_utf16.h>
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
Expand Down
5 changes: 1 addition & 4 deletions tests/convert_utf16le_to_utf8_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <array>

#include <tests/reference/validate_utf16.h>
#include <tests/reference/decode_utf16.h>
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
Expand Down Expand Up @@ -376,6 +375,4 @@ TEST(all_possible_8_codepoint_combinations) {
}
#endif

int main(int argc, char* argv[]) {
return simdutf::test::main(argc, argv);
}
TEST_MAIN
2 changes: 0 additions & 2 deletions tests/convert_utf16le_to_utf8_with_errors_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include <array>

#include <tests/reference/validate_utf16.h>
#include <tests/reference/decode_utf16.h>
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
Expand Down
1 change: 0 additions & 1 deletion tests/convert_utf32_to_latin1_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
#include <memory>

namespace {
std::array<size_t, 7> input_size{7, 16, 12, 64, 67, 128, 256};
Expand Down
1 change: 0 additions & 1 deletion tests/convert_utf32_to_latin1_with_errors_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
#include <memory>

namespace {
std::array<size_t, 7> input_size{7, 16, 12, 64, 67, 128, 256};
Expand Down
2 changes: 0 additions & 2 deletions tests/convert_utf32_to_utf16be_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include <array>

#include <tests/reference/validate_utf32.h>
#include <tests/reference/decode_utf32.h>
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
Expand Down
2 changes: 0 additions & 2 deletions tests/convert_utf32_to_utf16be_with_errors_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include <array>

#include <tests/reference/validate_utf32.h>
#include <tests/reference/decode_utf32.h>
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
Expand Down
2 changes: 0 additions & 2 deletions tests/convert_utf32_to_utf16le_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include <array>

#include <tests/reference/validate_utf32.h>
#include <tests/reference/decode_utf32.h>
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
Expand Down
2 changes: 0 additions & 2 deletions tests/convert_utf32_to_utf16le_with_errors_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include <array>

#include <tests/reference/validate_utf32.h>
#include <tests/reference/decode_utf32.h>
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
Expand Down
2 changes: 0 additions & 2 deletions tests/convert_utf32_to_utf8_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#include <array>
#include <memory>

#include <tests/reference/validate_utf32.h>
#include <tests/reference/decode_utf32.h>
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
Expand Down
2 changes: 0 additions & 2 deletions tests/convert_utf32_to_utf8_with_errors_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#include <array>
#include <memory>

#include <tests/reference/validate_utf32.h>
#include <tests/reference/decode_utf32.h>
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
Expand Down
5 changes: 1 addition & 4 deletions tests/convert_utf8_to_latin1_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@

#include <array>

#include <tests/reference/validate_utf8_to_latin1.h>
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
#include <sstream>

#include "reference/validate_utf8_to_latin1.h"


namespace {
std::array<size_t, 7> input_size{7, 16, 12, 64, 67, 128, 256};
Expand Down
16 changes: 4 additions & 12 deletions tests/convert_utf8_to_latin1_with_errors_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ TEST_LOOP(trials, convert_1_or_2_valid_UTF8_bytes_to_latin1) {
}
}

TEST(too_large_input) {
uint32_t seed{1234};
simdutf::tests::helpers::RandomIntRanges random({{0xff, 0x10FFFF}}, seed);

TEST_LOOP(trials, too_large_input) {
auto getUtf8SequenceLength = [](char byte) {
if ((byte & 0b11100000) == 0b11000000) { // 2 byte UTF-8 header
return 2;
Expand All @@ -79,7 +76,7 @@ auto getUtf8SequenceLength = [](char byte) {
}
};

for(size_t trial = 0; trial < trials; trial++) {
simdutf::tests::helpers::RandomIntRanges random({{0xff, 0x10FFFF}}, seed);
transcode_utf8_to_latin1_test_base test(random, fix_size);
for (int i = 0; i < fix_size; i++) {
auto byte_number = getUtf8SequenceLength(test.input_utf8[i]);
Expand All @@ -103,14 +100,10 @@ auto getUtf8SequenceLength = [](char byte) {

}
}
}
}

TEST(header_bits_error) {
uint32_t seed{1234};
simdutf::tests::helpers::RandomIntRanges random({{0x0000, 0xff}}, seed);

for(size_t trial = 0; trial < trials; trial++) {
TEST_LOOP(trials, header_bits_error) {
simdutf::tests::helpers::RandomIntRanges random({{0x0000, 0xff}}, seed);
transcode_utf8_to_latin1_test_base test(random, fix_size);

for (int i = 0; i < fix_size; i++) {
Expand All @@ -128,7 +121,6 @@ TEST(header_bits_error) {
test.input_utf8[i] = old;
}
}
}
}

TEST_LOOP(trials, too_short_error) {
Expand Down
2 changes: 1 addition & 1 deletion tests/convert_utf8_to_utf16be_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "simdutf.h"

#include <array>
#include <memory>

#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
#include <memory>

namespace {
std::array<size_t, 7> input_size{7, 16, 12, 64, 67, 128, 256};
Expand Down
2 changes: 1 addition & 1 deletion tests/convert_utf8_to_utf16be_with_errors_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include "simdutf.h"

#include <array>
#include <memory>

#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/random_utf8.h>
#include <tests/helpers/test.h>
#include <memory>

namespace {
std::array<size_t, 7> input_size{7, 16, 12, 64, 67, 128, 256};
Expand Down
6 changes: 2 additions & 4 deletions tests/convert_utf8_to_utf16le_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#include "simdutf.h"

#include <array>
#include <memory>

#include <tests/reference/validate_utf8.h>
#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
#include <memory>
#include <tests/helpers/random_utf8.h>

namespace {
Expand All @@ -16,9 +17,6 @@ namespace {
constexpr size_t trials = 10000;
}


#include "reference/validate_utf8.h"

TEST(convert_check_validation) {
fflush(NULL);
uint32_t seed{1234};
Expand Down
2 changes: 1 addition & 1 deletion tests/convert_utf8_to_utf16le_with_errors_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include "simdutf.h"

#include <array>
#include <memory>

#include <tests/helpers/transcode_test_base.h>
#include <tests/helpers/random_int.h>
#include <tests/helpers/random_utf8.h>
#include <tests/helpers/test.h>
#include <memory>

namespace {
std::array<size_t, 7> input_size{7, 16, 12, 64, 67, 128, 256};
Expand Down
2 changes: 1 addition & 1 deletion tests/convert_utf8_to_utf32_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <array>
#include <memory>
#include <string>

#include <tests/helpers/random_int.h>
#include <tests/helpers/test.h>
#include <tests/helpers/transcode_test_base.h>
Expand Down
Loading
Loading