mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Remove printf() linking hack
This commit is contained in:
parent
ba03cd95c5
commit
b881c0ec9e
107 changed files with 1520 additions and 2577 deletions
|
@ -21,8 +21,8 @@
|
|||
#include "libc/errno.h"
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/fmt/itoa.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/sysv/consts/at.h"
|
||||
#include "libc/sysv/consts/s.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
/*-*- 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 2023 Gabriel Ravier │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/str/str.h"
|
||||
|
||||
// We specifically avoid the test framework because otherwise __fmt_dtoa is
|
||||
// always automatically pulled in from code in there - and this is what we're
|
||||
// testing for here
|
||||
int main() {
|
||||
char buffer[30];
|
||||
|
||||
int snprintf_result = snprintf(buffer, sizeof(buffer), "%E", .0);
|
||||
if (strcmp(buffer, "0.000000E+00")) {
|
||||
kprintf(
|
||||
"error: snprintf gave us '%s' instead of the expected '0.000000E+00'\n",
|
||||
buffer);
|
||||
abort();
|
||||
}
|
||||
if (snprintf_result != 12) {
|
||||
kprintf("error: snprintf returned %d instead of 12\n", snprintf_result);
|
||||
abort();
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
/*-*- 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 2023 Gabriel Ravier │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/str/str.h"
|
||||
|
||||
// We specifically avoid the test framework because otherwise __fmt_dtoa is
|
||||
// always automatically pulled in from code in there - and this is what we're
|
||||
// testing for here
|
||||
int main() {
|
||||
char buffer[30];
|
||||
|
||||
int snprintf_result = snprintf(buffer, sizeof(buffer), "%F", .0);
|
||||
if (strcmp(buffer, "0.000000")) {
|
||||
kprintf("error: snprintf gave us '%s' instead of the expected '0.000000'\n",
|
||||
buffer);
|
||||
abort();
|
||||
}
|
||||
if (snprintf_result != 8) {
|
||||
kprintf("error: snprintf returned %d instead of 8\n", snprintf_result);
|
||||
abort();
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
/*-*- 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 2023 Gabriel Ravier │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/str/str.h"
|
||||
|
||||
// We specifically avoid the test framework because otherwise __fmt_dtoa is
|
||||
// always automatically pulled in from code in there - and this is what we're
|
||||
// testing for here
|
||||
int main() {
|
||||
char buffer[30];
|
||||
|
||||
int snprintf_result = snprintf(buffer, sizeof(buffer), "%G", .0);
|
||||
if (strcmp(buffer, "0")) {
|
||||
kprintf("error: snprintf gave us '%s' instead of the expected '0'\n",
|
||||
buffer);
|
||||
abort();
|
||||
}
|
||||
if (snprintf_result != 1) {
|
||||
kprintf("error: snprintf returned %d instead of 1\n", snprintf_result);
|
||||
abort();
|
||||
}
|
||||
}
|
|
@ -1,286 +0,0 @@
|
|||
/*-*- 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 │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
static const uint32_t kCescapecGolden[256] = {
|
||||
[0] = '\\' | '0' << 8 | '0' << 16 | '0' << 24,
|
||||
[1] = '\\' | '0' << 8 | '0' << 16 | '1' << 24,
|
||||
[2] = '\\' | '0' << 8 | '0' << 16 | '2' << 24,
|
||||
[3] = '\\' | '0' << 8 | '0' << 16 | '3' << 24,
|
||||
[4] = '\\' | '0' << 8 | '0' << 16 | '4' << 24,
|
||||
[5] = '\\' | '0' << 8 | '0' << 16 | '5' << 24,
|
||||
[6] = '\\' | '0' << 8 | '0' << 16 | '6' << 24,
|
||||
[7] = '\\' | 'a' << 8,
|
||||
[8] = '\\' | 'b' << 8,
|
||||
[9] = '\\' | 't' << 8,
|
||||
[10] = '\\' | 'n' << 8,
|
||||
[11] = '\\' | 'v' << 8,
|
||||
[12] = '\\' | 'f' << 8,
|
||||
[13] = '\\' | 'r' << 8,
|
||||
[14] = '\\' | '0' << 8 | '1' << 16 | '6' << 24,
|
||||
[15] = '\\' | '0' << 8 | '1' << 16 | '7' << 24,
|
||||
[16] = '\\' | '0' << 8 | '2' << 16 | '0' << 24,
|
||||
[17] = '\\' | '0' << 8 | '2' << 16 | '1' << 24,
|
||||
[18] = '\\' | '0' << 8 | '2' << 16 | '2' << 24,
|
||||
[19] = '\\' | '0' << 8 | '2' << 16 | '3' << 24,
|
||||
[20] = '\\' | '0' << 8 | '2' << 16 | '4' << 24,
|
||||
[21] = '\\' | '0' << 8 | '2' << 16 | '5' << 24,
|
||||
[22] = '\\' | '0' << 8 | '2' << 16 | '6' << 24,
|
||||
[23] = '\\' | '0' << 8 | '2' << 16 | '7' << 24,
|
||||
[24] = '\\' | '0' << 8 | '3' << 16 | '0' << 24,
|
||||
[25] = '\\' | '0' << 8 | '3' << 16 | '1' << 24,
|
||||
[26] = '\\' | '0' << 8 | '3' << 16 | '2' << 24,
|
||||
[27] = '\\' | '0' << 8 | '3' << 16 | '3' << 24,
|
||||
[28] = '\\' | '0' << 8 | '3' << 16 | '4' << 24,
|
||||
[29] = '\\' | '0' << 8 | '3' << 16 | '5' << 24,
|
||||
[30] = '\\' | '0' << 8 | '3' << 16 | '6' << 24,
|
||||
[31] = '\\' | '0' << 8 | '3' << 16 | '7' << 24,
|
||||
[32] = ' ',
|
||||
[33] = '!',
|
||||
[34] = '\\' | '"' << 8,
|
||||
[35] = '#',
|
||||
[36] = '$',
|
||||
[37] = '%',
|
||||
[38] = '&',
|
||||
[39] = '\\' | '\'' << 8,
|
||||
[40] = '(',
|
||||
[41] = ')',
|
||||
[42] = '*',
|
||||
[43] = '+',
|
||||
[44] = ',',
|
||||
[45] = '-',
|
||||
[46] = '.',
|
||||
[47] = '/',
|
||||
[48] = '0',
|
||||
[49] = '1',
|
||||
[50] = '2',
|
||||
[51] = '3',
|
||||
[52] = '4',
|
||||
[53] = '5',
|
||||
[54] = '6',
|
||||
[55] = '7',
|
||||
[56] = '8',
|
||||
[57] = '9',
|
||||
[58] = ':',
|
||||
[59] = ';',
|
||||
[60] = '<',
|
||||
[61] = '=',
|
||||
[62] = '>',
|
||||
[63] = '?',
|
||||
[64] = '@',
|
||||
[65] = 'A',
|
||||
[66] = 'B',
|
||||
[67] = 'C',
|
||||
[68] = 'D',
|
||||
[69] = 'E',
|
||||
[70] = 'F',
|
||||
[71] = 'G',
|
||||
[72] = 'H',
|
||||
[73] = 'I',
|
||||
[74] = 'J',
|
||||
[75] = 'K',
|
||||
[76] = 'L',
|
||||
[77] = 'M',
|
||||
[78] = 'N',
|
||||
[79] = 'O',
|
||||
[80] = 'P',
|
||||
[81] = 'Q',
|
||||
[82] = 'R',
|
||||
[83] = 'S',
|
||||
[84] = 'T',
|
||||
[85] = 'U',
|
||||
[86] = 'V',
|
||||
[87] = 'W',
|
||||
[88] = 'X',
|
||||
[89] = 'Y',
|
||||
[90] = 'Z',
|
||||
[91] = '[',
|
||||
[92] = '\\' | '\\' << 8,
|
||||
[93] = ']',
|
||||
[94] = '^',
|
||||
[95] = '_',
|
||||
[96] = '`',
|
||||
[97] = 'a',
|
||||
[98] = 'b',
|
||||
[99] = 'c',
|
||||
[100] = 'd',
|
||||
[101] = 'e',
|
||||
[102] = 'f',
|
||||
[103] = 'g',
|
||||
[104] = 'h',
|
||||
[105] = 'i',
|
||||
[106] = 'j',
|
||||
[107] = 'k',
|
||||
[108] = 'l',
|
||||
[109] = 'm',
|
||||
[110] = 'n',
|
||||
[111] = 'o',
|
||||
[112] = 'p',
|
||||
[113] = 'q',
|
||||
[114] = 'r',
|
||||
[115] = 's',
|
||||
[116] = 't',
|
||||
[117] = 'u',
|
||||
[118] = 'v',
|
||||
[119] = 'w',
|
||||
[120] = 'x',
|
||||
[121] = 'y',
|
||||
[122] = 'z',
|
||||
[123] = '{',
|
||||
[124] = '|',
|
||||
[125] = '}',
|
||||
[126] = '~',
|
||||
[127] = '\\' | '1' << 8 | '7' << 16 | '7' << 24,
|
||||
[128] = '\\' | '2' << 8 | '0' << 16 | '0' << 24,
|
||||
[129] = '\\' | '2' << 8 | '0' << 16 | '1' << 24,
|
||||
[130] = '\\' | '2' << 8 | '0' << 16 | '2' << 24,
|
||||
[131] = '\\' | '2' << 8 | '0' << 16 | '3' << 24,
|
||||
[132] = '\\' | '2' << 8 | '0' << 16 | '4' << 24,
|
||||
[133] = '\\' | '2' << 8 | '0' << 16 | '5' << 24,
|
||||
[134] = '\\' | '2' << 8 | '0' << 16 | '6' << 24,
|
||||
[135] = '\\' | '2' << 8 | '0' << 16 | '7' << 24,
|
||||
[136] = '\\' | '2' << 8 | '1' << 16 | '0' << 24,
|
||||
[137] = '\\' | '2' << 8 | '1' << 16 | '1' << 24,
|
||||
[138] = '\\' | '2' << 8 | '1' << 16 | '2' << 24,
|
||||
[139] = '\\' | '2' << 8 | '1' << 16 | '3' << 24,
|
||||
[140] = '\\' | '2' << 8 | '1' << 16 | '4' << 24,
|
||||
[141] = '\\' | '2' << 8 | '1' << 16 | '5' << 24,
|
||||
[142] = '\\' | '2' << 8 | '1' << 16 | '6' << 24,
|
||||
[143] = '\\' | '2' << 8 | '1' << 16 | '7' << 24,
|
||||
[144] = '\\' | '2' << 8 | '2' << 16 | '0' << 24,
|
||||
[145] = '\\' | '2' << 8 | '2' << 16 | '1' << 24,
|
||||
[146] = '\\' | '2' << 8 | '2' << 16 | '2' << 24,
|
||||
[147] = '\\' | '2' << 8 | '2' << 16 | '3' << 24,
|
||||
[148] = '\\' | '2' << 8 | '2' << 16 | '4' << 24,
|
||||
[149] = '\\' | '2' << 8 | '2' << 16 | '5' << 24,
|
||||
[150] = '\\' | '2' << 8 | '2' << 16 | '6' << 24,
|
||||
[151] = '\\' | '2' << 8 | '2' << 16 | '7' << 24,
|
||||
[152] = '\\' | '2' << 8 | '3' << 16 | '0' << 24,
|
||||
[153] = '\\' | '2' << 8 | '3' << 16 | '1' << 24,
|
||||
[154] = '\\' | '2' << 8 | '3' << 16 | '2' << 24,
|
||||
[155] = '\\' | '2' << 8 | '3' << 16 | '3' << 24,
|
||||
[156] = '\\' | '2' << 8 | '3' << 16 | '4' << 24,
|
||||
[157] = '\\' | '2' << 8 | '3' << 16 | '5' << 24,
|
||||
[158] = '\\' | '2' << 8 | '3' << 16 | '6' << 24,
|
||||
[159] = '\\' | '2' << 8 | '3' << 16 | '7' << 24,
|
||||
[160] = '\\' | '2' << 8 | '4' << 16 | '0' << 24,
|
||||
[161] = '\\' | '2' << 8 | '4' << 16 | '1' << 24,
|
||||
[162] = '\\' | '2' << 8 | '4' << 16 | '2' << 24,
|
||||
[163] = '\\' | '2' << 8 | '4' << 16 | '3' << 24,
|
||||
[164] = '\\' | '2' << 8 | '4' << 16 | '4' << 24,
|
||||
[165] = '\\' | '2' << 8 | '4' << 16 | '5' << 24,
|
||||
[166] = '\\' | '2' << 8 | '4' << 16 | '6' << 24,
|
||||
[167] = '\\' | '2' << 8 | '4' << 16 | '7' << 24,
|
||||
[168] = '\\' | '2' << 8 | '5' << 16 | '0' << 24,
|
||||
[169] = '\\' | '2' << 8 | '5' << 16 | '1' << 24,
|
||||
[170] = '\\' | '2' << 8 | '5' << 16 | '2' << 24,
|
||||
[171] = '\\' | '2' << 8 | '5' << 16 | '3' << 24,
|
||||
[172] = '\\' | '2' << 8 | '5' << 16 | '4' << 24,
|
||||
[173] = '\\' | '2' << 8 | '5' << 16 | '5' << 24,
|
||||
[174] = '\\' | '2' << 8 | '5' << 16 | '6' << 24,
|
||||
[175] = '\\' | '2' << 8 | '5' << 16 | '7' << 24,
|
||||
[176] = '\\' | '2' << 8 | '6' << 16 | '0' << 24,
|
||||
[177] = '\\' | '2' << 8 | '6' << 16 | '1' << 24,
|
||||
[178] = '\\' | '2' << 8 | '6' << 16 | '2' << 24,
|
||||
[179] = '\\' | '2' << 8 | '6' << 16 | '3' << 24,
|
||||
[180] = '\\' | '2' << 8 | '6' << 16 | '4' << 24,
|
||||
[181] = '\\' | '2' << 8 | '6' << 16 | '5' << 24,
|
||||
[182] = '\\' | '2' << 8 | '6' << 16 | '6' << 24,
|
||||
[183] = '\\' | '2' << 8 | '6' << 16 | '7' << 24,
|
||||
[184] = '\\' | '2' << 8 | '7' << 16 | '0' << 24,
|
||||
[185] = '\\' | '2' << 8 | '7' << 16 | '1' << 24,
|
||||
[186] = '\\' | '2' << 8 | '7' << 16 | '2' << 24,
|
||||
[187] = '\\' | '2' << 8 | '7' << 16 | '3' << 24,
|
||||
[188] = '\\' | '2' << 8 | '7' << 16 | '4' << 24,
|
||||
[189] = '\\' | '2' << 8 | '7' << 16 | '5' << 24,
|
||||
[190] = '\\' | '2' << 8 | '7' << 16 | '6' << 24,
|
||||
[191] = '\\' | '2' << 8 | '7' << 16 | '7' << 24,
|
||||
[192] = '\\' | '3' << 8 | '0' << 16 | '0' << 24,
|
||||
[193] = '\\' | '3' << 8 | '0' << 16 | '1' << 24,
|
||||
[194] = '\\' | '3' << 8 | '0' << 16 | '2' << 24,
|
||||
[195] = '\\' | '3' << 8 | '0' << 16 | '3' << 24,
|
||||
[196] = '\\' | '3' << 8 | '0' << 16 | '4' << 24,
|
||||
[197] = '\\' | '3' << 8 | '0' << 16 | '5' << 24,
|
||||
[198] = '\\' | '3' << 8 | '0' << 16 | '6' << 24,
|
||||
[199] = '\\' | '3' << 8 | '0' << 16 | '7' << 24,
|
||||
[200] = '\\' | '3' << 8 | '1' << 16 | '0' << 24,
|
||||
[201] = '\\' | '3' << 8 | '1' << 16 | '1' << 24,
|
||||
[202] = '\\' | '3' << 8 | '1' << 16 | '2' << 24,
|
||||
[203] = '\\' | '3' << 8 | '1' << 16 | '3' << 24,
|
||||
[204] = '\\' | '3' << 8 | '1' << 16 | '4' << 24,
|
||||
[205] = '\\' | '3' << 8 | '1' << 16 | '5' << 24,
|
||||
[206] = '\\' | '3' << 8 | '1' << 16 | '6' << 24,
|
||||
[207] = '\\' | '3' << 8 | '1' << 16 | '7' << 24,
|
||||
[208] = '\\' | '3' << 8 | '2' << 16 | '0' << 24,
|
||||
[209] = '\\' | '3' << 8 | '2' << 16 | '1' << 24,
|
||||
[210] = '\\' | '3' << 8 | '2' << 16 | '2' << 24,
|
||||
[211] = '\\' | '3' << 8 | '2' << 16 | '3' << 24,
|
||||
[212] = '\\' | '3' << 8 | '2' << 16 | '4' << 24,
|
||||
[213] = '\\' | '3' << 8 | '2' << 16 | '5' << 24,
|
||||
[214] = '\\' | '3' << 8 | '2' << 16 | '6' << 24,
|
||||
[215] = '\\' | '3' << 8 | '2' << 16 | '7' << 24,
|
||||
[216] = '\\' | '3' << 8 | '3' << 16 | '0' << 24,
|
||||
[217] = '\\' | '3' << 8 | '3' << 16 | '1' << 24,
|
||||
[218] = '\\' | '3' << 8 | '3' << 16 | '2' << 24,
|
||||
[219] = '\\' | '3' << 8 | '3' << 16 | '3' << 24,
|
||||
[220] = '\\' | '3' << 8 | '3' << 16 | '4' << 24,
|
||||
[221] = '\\' | '3' << 8 | '3' << 16 | '5' << 24,
|
||||
[222] = '\\' | '3' << 8 | '3' << 16 | '6' << 24,
|
||||
[223] = '\\' | '3' << 8 | '3' << 16 | '7' << 24,
|
||||
[224] = '\\' | '3' << 8 | '4' << 16 | '0' << 24,
|
||||
[225] = '\\' | '3' << 8 | '4' << 16 | '1' << 24,
|
||||
[226] = '\\' | '3' << 8 | '4' << 16 | '2' << 24,
|
||||
[227] = '\\' | '3' << 8 | '4' << 16 | '3' << 24,
|
||||
[228] = '\\' | '3' << 8 | '4' << 16 | '4' << 24,
|
||||
[229] = '\\' | '3' << 8 | '4' << 16 | '5' << 24,
|
||||
[230] = '\\' | '3' << 8 | '4' << 16 | '6' << 24,
|
||||
[231] = '\\' | '3' << 8 | '4' << 16 | '7' << 24,
|
||||
[232] = '\\' | '3' << 8 | '5' << 16 | '0' << 24,
|
||||
[233] = '\\' | '3' << 8 | '5' << 16 | '1' << 24,
|
||||
[234] = '\\' | '3' << 8 | '5' << 16 | '2' << 24,
|
||||
[235] = '\\' | '3' << 8 | '5' << 16 | '3' << 24,
|
||||
[236] = '\\' | '3' << 8 | '5' << 16 | '4' << 24,
|
||||
[237] = '\\' | '3' << 8 | '5' << 16 | '5' << 24,
|
||||
[238] = '\\' | '3' << 8 | '5' << 16 | '6' << 24,
|
||||
[239] = '\\' | '3' << 8 | '5' << 16 | '7' << 24,
|
||||
[240] = '\\' | '3' << 8 | '6' << 16 | '0' << 24,
|
||||
[241] = '\\' | '3' << 8 | '6' << 16 | '1' << 24,
|
||||
[242] = '\\' | '3' << 8 | '6' << 16 | '2' << 24,
|
||||
[243] = '\\' | '3' << 8 | '6' << 16 | '3' << 24,
|
||||
[244] = '\\' | '3' << 8 | '6' << 16 | '4' << 24,
|
||||
[245] = '\\' | '3' << 8 | '6' << 16 | '5' << 24,
|
||||
[246] = '\\' | '3' << 8 | '6' << 16 | '6' << 24,
|
||||
[247] = '\\' | '3' << 8 | '6' << 16 | '7' << 24,
|
||||
[248] = '\\' | '3' << 8 | '7' << 16 | '0' << 24,
|
||||
[249] = '\\' | '3' << 8 | '7' << 16 | '1' << 24,
|
||||
[250] = '\\' | '3' << 8 | '7' << 16 | '2' << 24,
|
||||
[251] = '\\' | '3' << 8 | '7' << 16 | '3' << 24,
|
||||
[252] = '\\' | '3' << 8 | '7' << 16 | '4' << 24,
|
||||
[253] = '\\' | '3' << 8 | '7' << 16 | '5' << 24,
|
||||
[254] = '\\' | '3' << 8 | '7' << 16 | '6' << 24,
|
||||
[255] = '\\' | '3' << 8 | '7' << 16 | '7' << 24,
|
||||
};
|
||||
|
||||
TEST(_cescapec, test) {
|
||||
int i;
|
||||
for (i = 0; i < 256; ++i) {
|
||||
ASSERT_EQ(kCescapecGolden[i], _cescapec(i));
|
||||
}
|
||||
}
|
|
@ -17,7 +17,6 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/fmt/fmt.h"
|
||||
|
||||
#include "libc/limits.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/math.h"
|
|
@ -611,8 +611,6 @@ TEST(snprintf, twosBaneWithTypePromotion) {
|
|||
}
|
||||
|
||||
TEST(snprintf, formatStringLiteral) {
|
||||
EXPECT_EQ('\\' | 'n' << 8, _cescapec('\n'));
|
||||
EXPECT_EQ('\\' | '3' << 8 | '7' << 16 | '7' << 24, _cescapec('\377'));
|
||||
EXPECT_STREQ("\"hi\\n\"", Format("%`'s", "hi\n"));
|
||||
EXPECT_STREQ("\"\\000\"", Format("%`'.*s", 1, "\0"));
|
||||
}
|
|
@ -39,7 +39,7 @@ static char buffer[128];
|
|||
#define SUITE(NAME) NAME##s
|
||||
#define FORMAT(STR) STR "s"
|
||||
#define STRING(STR) STR
|
||||
#include "test/libc/fmt/sprintf_s.inc"
|
||||
#include "test/libc/stdio/sprintf_s.inc"
|
||||
#undef SUITE
|
||||
#undef FORMAT
|
||||
#undef STRING
|
||||
|
@ -47,7 +47,7 @@ static char buffer[128];
|
|||
#define SUITE(NAME) NAME##hs
|
||||
#define FORMAT(STR) STR "hs"
|
||||
#define STRING(STR) u##STR
|
||||
#include "test/libc/fmt/sprintf_s.inc"
|
||||
#include "test/libc/stdio/sprintf_s.inc"
|
||||
#undef SUITE
|
||||
#undef FORMAT
|
||||
#undef STRING
|
||||
|
@ -55,7 +55,7 @@ static char buffer[128];
|
|||
#define SUITE(NAME) NAME##ls
|
||||
#define FORMAT(STR) STR "ls"
|
||||
#define STRING(STR) L##STR
|
||||
#include "test/libc/fmt/sprintf_s.inc"
|
||||
#include "test/libc/stdio/sprintf_s.inc"
|
||||
#undef SUITE
|
||||
#undef FORMAT
|
||||
#undef STRING
|
|
@ -64,7 +64,6 @@ TEST(sscanf, testOctal) {
|
|||
}
|
||||
|
||||
TEST(sscanf, testNonDirectiveCharacterMatching) {
|
||||
EXPECT_EQ(0, sscanf("", ""));
|
||||
EXPECT_EQ(0, sscanf("%", "%%"));
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/mem/gc.h"
|
||||
|
@ -25,7 +26,6 @@
|
|||
#include "libc/testlib/testlib.h"
|
||||
#include "libc/x/xasprintf.h"
|
||||
#include "third_party/double-conversion/wrapper.h"
|
||||
#include "third_party/gdtoa/gdtoa.h"
|
||||
|
||||
#define HEX(d) (union Pun){d}.i
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue