Skip to content

Commit

Permalink
Add some test cases that so far only ChatGPT passes. :(
Browse files Browse the repository at this point in the history
  • Loading branch information
jaykrell committed Jan 28, 2023
1 parent 2d1f1c7 commit 4e81912
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions radix_sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,61 @@ int main(int argc, char** argv)
assert(sorted.size() == 7);
}

if (chatGpt)
{
printf("\nline:%d\n", __LINE__);
constexpr int Base = 2;
TestRadixSorter<unsigned char, Base> test_sort;
test_sort.chatGpt = chatGpt;
unsigned char data[] = "foobar";
auto const sorted = test_sort(reverse, data, std::end(data));
assert(sorted.size() == 7);
}

if (chatGpt)
{
printf("\nline:%d\n", __LINE__);
constexpr int Base = 3;
TestRadixSorter<unsigned char, Base> test_sort;
test_sort.chatGpt = chatGpt;
unsigned char data[] = "foobar";
auto const sorted = test_sort(reverse, data, std::end(data));
assert(sorted.size() == 7);
}

if (chatGpt)
{
printf("\nline:%d\n", __LINE__);
constexpr int Base = 8;
TestRadixSorter<unsigned char, Base> test_sort;
test_sort.chatGpt = chatGpt;
unsigned char data[] = "foobar";
auto const sorted = test_sort(reverse, data, std::end(data));
assert(sorted.size() == 7);
}

if (chatGpt)
{
printf("\nline:%d\n", __LINE__);
constexpr int Base = 9;
TestRadixSorter<unsigned char, Base> test_sort;
test_sort.chatGpt = chatGpt;
unsigned char data[] = "foobar";
auto const sorted = test_sort(reverse, data, std::end(data));
assert(sorted.size() == 7);
}

if (chatGpt)
{
printf("\nline:%d\n", __LINE__);
constexpr int Base = 10;
TestRadixSorter<unsigned char, Base> test_sort;
test_sort.chatGpt = chatGpt;
unsigned char data[] = "foobar";
auto const sorted = test_sort(reverse, data, std::end(data));
assert(sorted.size() == 7);
}

srand(static_cast<unsigned>(time(0)));

// random data
Expand Down

0 comments on commit 4e81912

Please sign in to comment.