github.com/goshafaq/sonic@v0.0.0-20231026082336-871835fb94c6/native/unittest/test_to_lower.c (about)

     1  #include "../to_lower.c"
     2  #include <assert.h>
     3  #include <string.h>
     4  
     5  void 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  
    13  int main() {
    14      test_to_lower("Hello, World!", "hello, world!");
    15      test_to_lower("12345", "12345");
    16      test_to_lower("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz");
    17  }