commit f3e87e03934cf941cde711d0d2b6027e6c4e316c
parent 310e5dd324e0738ef8b8660f88010cb5582f954d
Author: Matsuda Kenji <info@mtkn.jp>
Date: Mon, 1 Apr 2024 11:14:53 +0900
delete test
Diffstat:
2 files changed, 0 insertions(+), 110 deletions(-)
diff --git a/test/Makefile b/test/Makefile
@@ -1,11 +0,0 @@
-CC = tcc
-SRC = utils_test.c ../utils.c
-
-all: test
- ./test
-
-test: $(SRC)
- $(CC) -O0 -g -o test $(SRC)
-
-clean:
- rm -f test
-\ No newline at end of file
diff --git a/test/utils_test.c b/test/utils_test.c
@@ -1,97 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "../uefi.h"
-#include "../utils.h"
-
-EFI_SYSTEM_TABLE *SystemTable;
-
-int
-str16cmp(CHAR16 *s, CHAR16 *t)
-{
- for (; *s != 0 && *t != 0; s++, t++) {
- if (*s == *t) {
- continue;
- } else if (*s < *t) {
- return -1;
- } else {
- return 1;
- }
- }
- if (*s != 0) {
- return 1;
- } else if (*t != 0) {
- return -1;
- } else {
- return 0;
- }
-}
-
-// Strtostr16 converts string s to UTF16 string.
-// Caller should free the returned pointer.
-CHAR16 *
-strtostr16(char *s)
-{
- int n;
- CHAR16 *ss, *st;
-
- n = strlen(s);
- ss = st = (CHAR16 *) malloc((n+1) * sizeof(CHAR16));
- if (!ss)
- return NULL;
- for (; *s; ) {
- *ss++ = (CHAR16) *s++;
- }
- return st;
-}
-
-char *
-str16tostr(CHAR16 *s)
-{
- int n = 0;
- CHAR16 *t;
- for (t = s; *t; t++) {
- n++;
- }
- char *ss, *tt;
- ss = tt = (char *)malloc((n + 1) * sizeof(char));
- if (!ss) {
- return NULL;
- }
- for (tt = ss, t = s; *t;) {
- *tt++ = (char) (*t++ & 0xff);
- }
- *tt = '\0';
- return ss;
-}
-
-int
-testSprinth()
-{
- int nerr = 0;
- struct test {
- UINT64 input;
- CHAR16 *want;
- } tests[] = {
- {0xdeadbeef, strtostr16("0x00000000deadbeef")},
- {0xcafecafe, strtostr16("0x00000000cafecafe")},
- {0, NULL},
- };
- struct test *t;
- CHAR16 got[19];
- for (t = tests; t->want; t++) {
- if (str16cmp(t->want, sprinth(t->input, got)) != 0) {
- fprintf(stderr, "sprinth(0x%x, got) = %s, want: %s\n",
- t->input, str16tostr(got), str16tostr(t->want));
- nerr++;
- }
- }
- return nerr;
-}
-
-int
-main(void)
-{
- testSprinth();
-}
-\ No newline at end of file