Add chibicc
This program popped up on Hacker News recently. It's the only modern compiler I've ever seen that doesn't have dependencies and is easily modified. So I added all of the missing GNU extensions I like to use which means it might be possible soon to build on non-Linux and have third party not vendor gcc binaries.
This commit is contained in:
@@ -21,10 +21,21 @@
|
||||
#include "libc/conv/conv.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
TEST(strtoimax, testZero) { EXPECT_EQ(0, strtoimax("0", NULL, 0)); }
|
||||
TEST(strtoimax, testDecimal) { EXPECT_EQ(-123, strtoimax("-123", NULL, 0)); }
|
||||
TEST(strtoimax, testHex) { EXPECT_EQ(-255, strtoimax("-0xff", NULL, 0)); }
|
||||
TEST(strtoimax, testOctal) { EXPECT_EQ(-123, strtoimax("-0173", NULL, 0)); }
|
||||
TEST(strtoimax, testZero) {
|
||||
EXPECT_EQ(0, strtoimax("0", NULL, 0));
|
||||
}
|
||||
|
||||
TEST(strtoimax, testDecimal) {
|
||||
EXPECT_EQ(-123, strtoimax("-123", NULL, 0));
|
||||
}
|
||||
|
||||
TEST(strtoimax, testHex) {
|
||||
EXPECT_EQ(-255, strtoimax("-0xff", NULL, 0));
|
||||
}
|
||||
|
||||
TEST(strtoimax, testOctal) {
|
||||
EXPECT_EQ(-123, strtoimax("-0173", NULL, 0));
|
||||
}
|
||||
|
||||
TEST(strtoimax, testLimits) {
|
||||
EXPECT_EQ(
|
||||
@@ -35,12 +46,6 @@ TEST(strtoimax, testLimits) {
|
||||
strtoimax("0x7fffffffffffffffffffffffffffffff", NULL, 0));
|
||||
}
|
||||
|
||||
TEST(strtoimax, testZeroExtend) {
|
||||
EXPECT_EQ(-1, strtoimax("-1", NULL, 0));
|
||||
EXPECT_EQ(0xffffffff, strtoimax("-1u", NULL, 0));
|
||||
EXPECT_EQ(0xffffffffffffffff, strtoimax("-1ul", NULL, 0));
|
||||
}
|
||||
|
||||
TEST(strtoimax, testTwosBane) {
|
||||
EXPECT_EQ(((uintmax_t)0x8000000000000000) << 64 | 0x0000000000000000,
|
||||
strtoimax("0x80000000000000000000000000000000", NULL, 0));
|
||||
|
||||
Reference in New Issue
Block a user