implement game configuration file

this integrates https://github.com/cktan/tomlc99 into the repo as a dependency
This commit is contained in:
2024-09-30 21:13:58 -03:00
committed by veclavtalica
parent ec15d8ec4b
commit 57fe5e8946
165 changed files with 4797 additions and 92 deletions

11
third-party/tomlc99/unittest/Makefile vendored Normal file
View File

@ -0,0 +1,11 @@
CFLAGS = -g -I..
TESTS = t1
all: $(TESTS)
t1: t1.c ../toml.c
clean:
rm -f $(TESTS)

73
third-party/tomlc99/unittest/t1.c vendored Normal file
View File

@ -0,0 +1,73 @@
#include "../toml.h"
#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
int main(int argc, const char *argv[]) {
char xxbuf[6], buf[6];
int64_t xxcode, code;
int xxsize;
xxsize = 2, xxcode = 0x80;
memcpy(xxbuf, "\xc2\x80", xxsize);
assert(toml_ucs_to_utf8(xxcode, buf) == xxsize &&
0 == memcmp(buf, xxbuf, xxsize));
assert(toml_utf8_to_ucs(buf, xxsize, &code) == xxsize && code == xxcode);
xxsize = 2, xxcode = 0x7ff;
memcpy(xxbuf, "\xdf\xbf", xxsize);
assert(toml_ucs_to_utf8(xxcode, buf) == xxsize &&
0 == memcmp(buf, xxbuf, xxsize));
assert(toml_utf8_to_ucs(buf, xxsize, &code) == xxsize && code == xxcode);
xxsize = 3, xxcode = 0x800;
memcpy(xxbuf, "\xe0\xa0\x80", xxsize);
assert(toml_ucs_to_utf8(xxcode, buf) == xxsize &&
0 == memcmp(buf, xxbuf, xxsize));
assert(toml_utf8_to_ucs(buf, xxsize, &code) == xxsize && code == xxcode);
xxsize = 3, xxcode = 0xfffd;
memcpy(xxbuf, "\xef\xbf\xbd", xxsize);
assert(toml_ucs_to_utf8(xxcode, buf) == xxsize &&
0 == memcmp(buf, xxbuf, xxsize));
assert(toml_utf8_to_ucs(buf, xxsize, &code) == xxsize && code == xxcode);
xxsize = 4, xxcode = 0x10000;
memcpy(xxbuf, "\xf0\x90\x80\x80", xxsize);
assert(toml_ucs_to_utf8(xxcode, buf) == xxsize &&
0 == memcmp(buf, xxbuf, xxsize));
assert(toml_utf8_to_ucs(buf, xxsize, &code) == xxsize && code == xxcode);
xxsize = 4, xxcode = 0x1fffff;
memcpy(xxbuf, "\xf7\xbf\xbf\xbf", xxsize);
assert(toml_ucs_to_utf8(xxcode, buf) == xxsize &&
0 == memcmp(buf, xxbuf, xxsize));
assert(toml_utf8_to_ucs(buf, xxsize, &code) == xxsize && code == xxcode);
xxsize = 5, xxcode = 0x200000;
memcpy(xxbuf, "\xf8\x88\x80\x80\x80", xxsize);
assert(toml_ucs_to_utf8(xxcode, buf) == xxsize &&
0 == memcmp(buf, xxbuf, xxsize));
assert(toml_utf8_to_ucs(buf, xxsize, &code) == xxsize && code == xxcode);
xxsize = 5, xxcode = 0x3ffffff;
memcpy(xxbuf, "\xfb\xbf\xbf\xbf\xbf", xxsize);
assert(toml_ucs_to_utf8(xxcode, buf) == xxsize &&
0 == memcmp(buf, xxbuf, xxsize));
assert(toml_utf8_to_ucs(buf, xxsize, &code) == xxsize && code == xxcode);
xxsize = 6, xxcode = 0x4000000;
memcpy(xxbuf, "\xfc\x84\x80\x80\x80\x80", xxsize);
assert(toml_ucs_to_utf8(xxcode, buf) == xxsize &&
0 == memcmp(buf, xxbuf, xxsize));
assert(toml_utf8_to_ucs(buf, xxsize, &code) == xxsize && code == xxcode);
xxsize = 6, xxcode = 0x7fffffff;
memcpy(xxbuf, "\xfd\xbf\xbf\xbf\xbf\xbf", xxsize);
assert(toml_ucs_to_utf8(xxcode, buf) == xxsize &&
0 == memcmp(buf, xxbuf, xxsize));
assert(toml_utf8_to_ucs(buf, xxsize, &code) == xxsize && code == xxcode);
return 0;
}