mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-27 15:52:28 +00:00
Add NetBSD support
This commit is contained in:
parent
2fdc19e7a7
commit
23ae9dfceb
4020 changed files with 8955 additions and 8128 deletions
|
@ -1,7 +1,7 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ Copyright 2021 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
|
@ -16,11 +16,28 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/hyperion.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
#include "libc/unicode/unicode.h"
|
||||
|
||||
TEST(strwidth, test) {
|
||||
EXPECT_EQ(5, strwidth("hello"));
|
||||
EXPECT_EQ(5, strwidth("\1he\e[0;0mllo\e#8"));
|
||||
EXPECT_EQ(10, strwidth("HELLO"));
|
||||
EXPECT_EQ(5, strwidth("hello", 0));
|
||||
EXPECT_EQ(5, strwidth("\1he\e[0;0mllo\e#8", 0));
|
||||
EXPECT_EQ(10, strwidth("HELLO", 0));
|
||||
}
|
||||
|
||||
TEST(strwidth, tab) {
|
||||
EXPECT_EQ(8, strwidth("\t", 0));
|
||||
EXPECT_EQ(8, strwidth(" \t", 0));
|
||||
EXPECT_EQ(8, strwidth(" \t", 0));
|
||||
EXPECT_EQ(16, strwidth(" \t", 0));
|
||||
}
|
||||
|
||||
TEST(strwidth, hyperion) {
|
||||
ASSERT_EQ(22304, strwidth(kHyperion, 0));
|
||||
}
|
||||
|
||||
BENCH(strnwidth, bench) {
|
||||
EZBENCH2("strnwidth", donothing, EXPROPRIATE(strnwidth(kHyperion, -1, 0)));
|
||||
}
|
|
@ -23,11 +23,15 @@ TEST_LIBC_UNICODE_CHECKS = \
|
|||
$(TEST_LIBC_UNICODE_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
||||
|
||||
TEST_LIBC_UNICODE_DIRECTDEPS = \
|
||||
LIBC_CALLS \
|
||||
LIBC_INTRIN \
|
||||
LIBC_MEM \
|
||||
LIBC_NEXGEN32E \
|
||||
LIBC_LOG \
|
||||
LIBC_STR \
|
||||
LIBC_STUBS \
|
||||
LIBC_TESTLIB \
|
||||
LIBC_SYSV \
|
||||
LIBC_UNICODE
|
||||
|
||||
TEST_LIBC_UNICODE_DEPS := \
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
|
||||
TEST(strwidth, testCjkWidesAndCombiningLowLines_withThompsonPikeEncoding) {
|
||||
/*───────────────────────────────────────────────────┬─*/
|
||||
EXPECT_EQ(20, strwidth(/**/ "𐌰𐌱𐌲𐌳𐌴𐌵𐌶𐌷▒▒▒▒▒▒▒▒▒▒▒▒" /*│*/));
|
||||
EXPECT_EQ(20, strwidth(/**/ "(╯°□°)╯𐄻︵ ̲┻̲━̲┻▒▒▒▒▒▒" /*│*/));
|
||||
EXPECT_EQ(20, strwidth(/**/ "ちゃぶ台返し▒▒▒▒▒▒▒▒" /*│*/));
|
||||
EXPECT_EQ(20, strwidth(/**/ "𐌰𐌱𐌲𐌳𐌴𐌵𐌶𐌷▒▒▒▒▒▒▒▒▒▒▒▒" /*│*/, 0));
|
||||
EXPECT_EQ(20, strwidth(/**/ "(╯°□°)╯𐄻︵ ̲┻̲━̲┻▒▒▒▒▒▒" /*│*/, 0));
|
||||
EXPECT_EQ(20, strwidth(/**/ "ちゃぶ台返し▒▒▒▒▒▒▒▒" /*│*/, 0));
|
||||
EXPECT_EQ(20, strclen(/*─*/ "𐌰𐌱𐌲𐌳𐌴𐌵𐌶𐌷▒▒▒▒▒▒▒▒▒▒▒▒" /*│*/));
|
||||
EXPECT_EQ(22, strclen(/*─*/ "(╯°□°)╯𐄻︵ ̲┻̲━̲┻▒▒▒▒▒▒" /*│*/));
|
||||
EXPECT_EQ(14, strclen(/*─*/ "ちゃぶ台返し▒▒▒▒▒▒▒▒" /*│*/));
|
||||
|
@ -38,9 +38,9 @@ TEST(strwidth, testCjkWidesAndCombiningLowLines_withThompsonPikeEncoding) {
|
|||
|
||||
TEST(strwidth16, testCjkWidesAndCombiningLowLines_lengthIsNotShorts) {
|
||||
/*──────────────────────────────────────────────────────┬─*/
|
||||
EXPECT_EQ(20, strwidth16(/**/ u"𐌰𐌱𐌲𐌳𐌴𐌵𐌶𐌷▒▒▒▒▒▒▒▒▒▒▒▒" /*│*/));
|
||||
EXPECT_EQ(20, strwidth16(/**/ u"(╯°□°)╯𐄻︵ ̲┻̲━̲┻▒▒▒▒▒▒" /*│*/));
|
||||
EXPECT_EQ(20, strwidth16(/**/ u"ちゃぶ台返し▒▒▒▒▒▒▒▒" /*│*/));
|
||||
EXPECT_EQ(20, strwidth16(/**/ u"𐌰𐌱𐌲𐌳𐌴𐌵𐌶𐌷▒▒▒▒▒▒▒▒▒▒▒▒" /*│*/, 0));
|
||||
EXPECT_EQ(20, strwidth16(/**/ u"(╯°□°)╯𐄻︵ ̲┻̲━̲┻▒▒▒▒▒▒" /*│*/, 0));
|
||||
EXPECT_EQ(20, strwidth16(/**/ u"ちゃぶ台返し▒▒▒▒▒▒▒▒" /*│*/, 0));
|
||||
EXPECT_EQ(20, strclen16(/*─*/ u"𐌰𐌱𐌲𐌳𐌴𐌵𐌶𐌷▒▒▒▒▒▒▒▒▒▒▒▒" /*│*/));
|
||||
EXPECT_EQ(22, strclen16(/*─*/ u"(╯°□°)╯𐄻︵ ̲┻̲━̲┻▒▒▒▒▒▒" /*│*/));
|
||||
EXPECT_EQ(14, strclen16(/*─*/ u"ちゃぶ台返し▒▒▒▒▒▒▒▒" /*│*/));
|
||||
|
@ -52,9 +52,9 @@ TEST(strwidth16, testCjkWidesAndCombiningLowLines_lengthIsNotShorts) {
|
|||
|
||||
TEST(wcwidth, testCjkWidesAndCombiningLowLines_widthIsNotLength) {
|
||||
/*────────────────────────────────────────────────────┬─*/
|
||||
EXPECT_EQ(20, wcswidth(/**/ L"Table flip▒▒▒▒▒▒▒▒▒▒" /*│*/));
|
||||
EXPECT_EQ(20, wcswidth(/**/ L"(╯°□°)╯︵ ̲┻̲━̲┻▒▒▒▒▒▒▒" /*│*/));
|
||||
EXPECT_EQ(20, wcswidth(/**/ L"ちゃぶ台返し▒▒▒▒▒▒▒▒" /*│*/));
|
||||
EXPECT_EQ(20, wcswidth(/**/ L"Table flip▒▒▒▒▒▒▒▒▒▒" /*│*/, 0));
|
||||
EXPECT_EQ(20, wcswidth(/**/ L"(╯°□°)╯︵ ̲┻̲━̲┻▒▒▒▒▒▒▒" /*│*/, 0));
|
||||
EXPECT_EQ(20, wcswidth(/**/ L"ちゃぶ台返し▒▒▒▒▒▒▒▒" /*│*/, 0));
|
||||
EXPECT_EQ(20, wcslen(/*──*/ L"Table flip▒▒▒▒▒▒▒▒▒▒" /*│*/));
|
||||
EXPECT_EQ(22, wcslen(/*──*/ L"(╯°□°)╯︵ ̲┻̲━̲┻▒▒▒▒▒▒▒" /*│*/));
|
||||
EXPECT_EQ(14, wcslen(/*──*/ L"ちゃぶ台返し▒▒▒▒▒▒▒▒" /*│*/));
|
||||
|
@ -66,8 +66,8 @@ TEST(wcwidth, block) {
|
|||
}
|
||||
|
||||
TEST(strwidth, testTextDelimitingControlCodes_dontHaveSubstance) {
|
||||
EXPECT_EQ(0, strwidth("\0"));
|
||||
EXPECT_EQ(0, strwidth("\1"));
|
||||
EXPECT_EQ(0, strwidth("\0", 0));
|
||||
EXPECT_EQ(0, strwidth("\1", 0));
|
||||
}
|
||||
|
||||
BENCH(wcwidth, bench) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue