mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-25 14:52:28 +00:00
Add Deflate() / Inflate() to redbean and fix bugs
The Compress() and Uncompress() APIs were a mistake. The functions themselves work fine, but it's a design blemish and does superfluous work. Since they were only introduced in the last few weeks, they're now deprecated and references to them have been scrubbed from the website and other documentation. Please use the new APIs since the old APIs will be removed at some point in the future. This change introduces automated Lua unit tests for the Redbean APIs. There's a few functions that were broken which have now been fixed, e.g. Underlong() and Decimate().
This commit is contained in:
parent
a18044c504
commit
fe5c475f83
12 changed files with 347 additions and 98 deletions
|
@ -22,6 +22,11 @@
|
|||
#include "libc/testlib/testlib.h"
|
||||
#include "libc/unicode/unicode.h"
|
||||
|
||||
TEST(wcwidth, test) {
|
||||
ASSERT_EQ(0, wcwidth(0));
|
||||
ASSERT_EQ(-1, wcwidth(1));
|
||||
}
|
||||
|
||||
TEST(strwidth, testCjkWidesAndCombiningLowLines_withThompsonPikeEncoding) {
|
||||
/*───────────────────────────────────────────────────┬─*/
|
||||
EXPECT_EQ(20, strwidth(/**/ "𐌰𐌱𐌲𐌳𐌴𐌵𐌶𐌷▒▒▒▒▒▒▒▒▒▒▒▒" /*│*/, 0));
|
||||
|
@ -63,6 +68,8 @@ TEST(wcwidth, testCjkWidesAndCombiningLowLines_widthIsNotLength) {
|
|||
|
||||
TEST(wcwidth, block) {
|
||||
EXPECT_EQ(1, wcwidth(u'▄'));
|
||||
EXPECT_EQ(0x3061, L'ち');
|
||||
EXPECT_EQ(2, wcwidth(L'ち'));
|
||||
}
|
||||
|
||||
TEST(strwidth, testTextDelimitingControlCodes_dontHaveSubstance) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue