...

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

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

     1#include "native.c"
     2#include <assert.h>
     3#include <string.h>
     4
     5void test_u64toa(uint64_t input, const char* expect) {
     6    char buf[64] = {0};
     7    u64toa(buf, input);
     8    assert(strcmp(expect, buf) == 0);
     9}
    10
    11int main() {
    12    test_u64toa(0, "0");
    13    test_u64toa(1, "1");
    14    test_u64toa(1345, "1345");
    15    // test max uint64
    16    test_u64toa(18446744073709551615ULL, "18446744073709551615");
    17}

View as plain text