...

Text file src/github.com/bytedance/sonic/native/unittest/test_to_lower.c

Documentation: github.com/bytedance/sonic/native/unittest

     1#include "../to_lower.c"
     2#include <assert.h>
     3#include <string.h>
     4
     5void test_to_lower(const char* input, const char* expect) {
     6    unsigned long len = strlen(input);
     7    char* dst = (char*)malloc(len);
     8    to_lower(dst, input, len);
     9    assert(strncmp(expect, dst, len) == 0);
    10    free(dst);
    11}
    12
    13int main() {
    14    test_to_lower("Hello, World!", "hello, world!");
    15    test_to_lower("12345", "12345");
    16    test_to_lower("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz");
    17}

View as plain text