aboutsummaryrefslogtreecommitdiff
path: root/lib/libk/string/test_string.cc
blob: d12b31897c1ba5091b65e226304c2cd84b43d856 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <gtest/gtest.h>

namespace libk {
#include "itoa.c"
}

char buffer[64];

TEST(itoa, itoa)
{
  EXPECT_STREQ(libk::itoa(buffer, 12341234, 10), "12341234");
  EXPECT_STREQ(libk::itoa(buffer, -12341234, 10), "-12341234");
  EXPECT_STREQ(libk::itoa(buffer, 0x7fffffff, 16), "7fffffff");
}

TEST(itoa, utoa)
{
  EXPECT_STREQ(libk::utoa(buffer, 12341234u, 10), "12341234");
  EXPECT_STREQ(libk::utoa(buffer, 0xdecafade, 16), "decafade");
}