Make numerous improvements

- Python static hello world now 1.8mb
- Python static fully loaded now 10mb
- Python HTTPS client now uses MbedTLS
- Python REPL now completes import stmts
- Increase stack size for Python for now
- Begin synthesizing posixpath and ntpath
- Restore Python \N{UNICODE NAME} support
- Restore Python NFKD symbol normalization
- Add optimized code path for Intel SHA-NI
- Get more Python unit tests passing faster
- Get Python help() pagination working on NT
- Python hashlib now supports MbedTLS PBKDF2
- Make memcpy/memmove/memcmp/bcmp/etc. faster
- Add Mersenne Twister and Vigna to LIBC_RAND
- Provide privileged __printf() for error code
- Fix zipos opendir() so that it reports ENOTDIR
- Add basic chmod() implementation for Windows NT
- Add Cosmo's best functions to Python cosmo module
- Pin function trace indent depth to that of caller
- Show memory diagram on invalid access in MODE=dbg
- Differentiate stack overflow on crash in MODE=dbg
- Add stb_truetype and tools for analyzing font files
- Upgrade to UNICODE 13 and reduce its binary footprint
- COMPILE.COM now logs resource usage of build commands
- Start implementing basic poll() support on bare metal
- Set getauxval(AT_EXECFN) to GetModuleFileName() on NT
- Add descriptions to strerror() in non-TINY build modes
- Add COUNTBRANCH() macro to help with micro-optimizations
- Make error / backtrace / asan / memory code more unbreakable
- Add fast perfect C implementation of μ-Law and a-Law audio codecs
- Make strtol() functions consistent with other libc implementations
- Improve Linenoise implementation (see also github.com/jart/bestline)
- COMPILE.COM now suppresses stdout/stderr of successful build commands
This commit is contained in:
Justine Tunney 2021-09-27 22:58:51 -07:00
parent fa7b4f5bd1
commit 39bf41f4eb
806 changed files with 77494 additions and 63859 deletions

View file

@ -442,22 +442,126 @@ TEST(wcstol, testBase36) {
EXPECT_EQ(29234652, wcstol(L"HELLO", 0, 36));
}
BENCH(atoi, bench) {
EZBENCH2("atoi", donothing, EXPROPRIATE(atoi(VEIL("r", "123456789"))));
EZBENCH2("strtol", donothing,
EXPROPRIATE(strtol(VEIL("r", "123456789"), 0, 10)));
EZBENCH2("strtoul", donothing,
EXPROPRIATE(strtol(VEIL("r", "123456789"), 0, 10)));
EZBENCH2("wcstol", donothing,
EXPROPRIATE(wcstol(VEIL("r", L"123456789"), 0, 10)));
EZBENCH2("wcstoul", donothing,
EXPROPRIATE(wcstol(VEIL("r", L"123456789"), 0, 10)));
EZBENCH2("strtoimax", donothing,
EXPROPRIATE(strtoimax(VEIL("r", "123456789"), 0, 10)));
EZBENCH2("strtoumax", donothing,
EXPROPRIATE(strtoimax(VEIL("r", "123456789"), 0, 10)));
EZBENCH2("wcstoimax", donothing,
EXPROPRIATE(wcstoimax(VEIL("r", L"123456789"), 0, 10)));
EZBENCH2("wcstoumax", donothing,
EXPROPRIATE(wcstoimax(VEIL("r", L"123456789"), 0, 10)));
TEST(strtol, testWormsMeat) {
ASSERT_EQ(0x4e00, strtol("0x4e00", 0, 0));
}
TEST(strtol, testIBM) {
char *e;
ASSERT_EQ(1, strtol("1e-", &e, 10));
ASSERT_STREQ("e-", e);
ASSERT_EQ(0, strtol("-", &e, 10));
ASSERT_STREQ("-", e);
ASSERT_EQ(0, strtol("0f", &e, 10));
ASSERT_STREQ("f", e);
}
TEST(strtoul, testIBM) {
char *e;
ASSERT_EQ(1, strtoul("1e-", &e, 10));
ASSERT_STREQ("e-", e);
ASSERT_EQ(0, strtoul("-", &e, 10));
ASSERT_STREQ("-", e);
ASSERT_EQ(0, strtoul("0f", &e, 10));
ASSERT_STREQ("f", e);
}
TEST(strtoll, testIBM) {
char *e;
ASSERT_EQ(1, strtoll("1e-", &e, 10));
ASSERT_STREQ("e-", e);
ASSERT_EQ(0, strtoll("-", &e, 10));
ASSERT_STREQ("-", e);
ASSERT_EQ(0, strtoll("0f", &e, 10));
ASSERT_STREQ("f", e);
}
TEST(strtoull, testIBM) {
char *e;
ASSERT_EQ(1, strtoull("1e-", &e, 10));
ASSERT_STREQ("e-", e);
ASSERT_EQ(0, strtoull("-", &e, 10));
ASSERT_STREQ("-", e);
ASSERT_EQ(0, strtoull("0f", &e, 10));
ASSERT_STREQ("f", e);
}
TEST(strtoimax, testIBM) {
char *e;
ASSERT_EQ(1, strtoimax("1e-", &e, 10));
ASSERT_STREQ("e-", e);
ASSERT_EQ(0, strtoimax("-", &e, 10));
ASSERT_STREQ("-", e);
ASSERT_EQ(0, strtoimax("0f", &e, 10));
ASSERT_STREQ("f", e);
}
TEST(strtoumax, testIBM) {
char *e;
ASSERT_EQ(1, strtoumax("1e-", &e, 10));
ASSERT_STREQ("e-", e);
ASSERT_EQ(0, strtoumax("-", &e, 10));
ASSERT_STREQ("-", e);
ASSERT_EQ(0, strtoumax("0f", &e, 10));
ASSERT_STREQ("f", e);
}
TEST(wcstol, testIBM) {
wchar_t *e;
ASSERT_EQ(1, wcstol(L"1e-", &e, 10));
ASSERT_STREQ(L"e-", e);
ASSERT_EQ(0, wcstol(L"-", &e, 10));
ASSERT_STREQ(L"-", e);
ASSERT_EQ(0, wcstol(L"0f", &e, 10));
ASSERT_STREQ(L"f", e);
}
TEST(wcstoul, testIBM) {
wchar_t *e;
ASSERT_EQ(1, wcstoul(L"1e-", &e, 10));
ASSERT_STREQ(L"e-", e);
ASSERT_EQ(0, wcstoul(L"-", &e, 10));
ASSERT_STREQ(L"-", e);
ASSERT_EQ(0, wcstoul(L"0f", &e, 10));
ASSERT_STREQ(L"f", e);
}
TEST(wcstoimax, testIBM) {
wchar_t *e;
ASSERT_EQ(1, wcstoimax(L"1e-", &e, 10));
ASSERT_STREQ(L"e-", e);
ASSERT_EQ(0, wcstoimax(L"-", &e, 10));
ASSERT_STREQ(L"-", e);
ASSERT_EQ(0, wcstoimax(L"0f", &e, 10));
ASSERT_STREQ(L"f", e);
}
TEST(wcstoumax, testIBM) {
wchar_t *e;
ASSERT_EQ(1, wcstoumax(L"1e-", &e, 10));
ASSERT_STREQ(L"e-", e);
ASSERT_EQ(0, wcstoumax(L"-", &e, 10));
ASSERT_STREQ(L"-", e);
ASSERT_EQ(0, wcstoumax(L"0f", &e, 10));
ASSERT_STREQ(L"f", e);
}
BENCH(atoi, bench) {
EZBENCH2("atoi 10⁸", donothing, EXPROPRIATE(atoi(VEIL("r", "100000000"))));
EZBENCH2("strtol 10⁸", donothing,
EXPROPRIATE(strtol(VEIL("r", "100000000"), 0, 10)));
EZBENCH2("strtoul 10⁸", donothing,
EXPROPRIATE(strtol(VEIL("r", "100000000"), 0, 10)));
EZBENCH2("wcstol 10⁸", donothing,
EXPROPRIATE(wcstol(VEIL("r", L"100000000"), 0, 10)));
EZBENCH2("wcstoul 10⁸", donothing,
EXPROPRIATE(wcstol(VEIL("r", L"100000000"), 0, 10)));
EZBENCH2("strtoimax 10⁸", donothing,
EXPROPRIATE(strtoimax(VEIL("r", "100000000"), 0, 10)));
EZBENCH2("strtoumax 10⁸", donothing,
EXPROPRIATE(strtoimax(VEIL("r", "100000000"), 0, 10)));
EZBENCH2("wcstoimax 10⁸", donothing,
EXPROPRIATE(wcstoimax(VEIL("r", L"100000000"), 0, 10)));
EZBENCH2("wcstoumax 10⁸", donothing,
EXPROPRIATE(wcstoimax(VEIL("r", L"100000000"), 0, 10)));
}