Compare commits

...

3 Commits

Author SHA1 Message Date
1e24a4ee92 add a CI status badge to the README.md 2025-09-18 09:58:05 +02:00
181fca6828 fix: windows test; USERPROFILE should also result in a roaming path. 2025-09-18 09:50:56 +02:00
f6e5712876 fix: testing warnings 2025-09-18 09:47:31 +02:00
2 changed files with 15 additions and 13 deletions

View File

@@ -7,6 +7,8 @@ A from-scratch rewrite of [mcaselector](https://github.com/Querz/mcaselector) in
[![licence](https://img.shields.io/github/license/thepigeongenerator/mcaselector-lite.svg)](https://github.com/thepigeongenerator/mcaselector-lite/blob/main/LICENSE) [![licence](https://img.shields.io/github/license/thepigeongenerator/mcaselector-lite.svg)](https://github.com/thepigeongenerator/mcaselector-lite/blob/main/LICENSE)
[![issues](https://img.shields.io/github/issues/thepigeongenerator/mcaselector-lite.svg)](https://github.com/thepigeongenerator/mcaselector-lite/issues/) [![issues](https://img.shields.io/github/issues/thepigeongenerator/mcaselector-lite.svg)](https://github.com/thepigeongenerator/mcaselector-lite/issues/)
[![CI-status](https://github.com/thepigeongenerator/mcaselector-lite/actions/workflows/ci.yaml/badge.svg)](https://github.com/thepigeongenerator/mcaselector-lite/actions/workflows/ci.yaml)
## what does it do ## what does it do
MCA selector lite is a tool used to edit [region files](https://minecraft.wiki/w/Region_file_format) of your [Minecraft java](https://minecraft.wiki/w/Java_Edition) worlds. MCA selector lite is a tool used to edit [region files](https://minecraft.wiki/w/Region_file_format) of your [Minecraft java](https://minecraft.wiki/w/Java_Edition) worlds.
This is useful for reducing world size, general world management, perhaps copying chunks from one world to another or various other administrative tasks. This is useful for reducing world size, general world management, perhaps copying chunks from one world to another or various other administrative tasks.

View File

@@ -12,15 +12,15 @@ void test_conf_procbuf(const char *restrict buf, const char *restrict expect_key
size_t len = strlen(buf) + 1; size_t len = strlen(buf) + 1;
char k[len], v[len]; char k[len], v[len];
*k = '\0', *v = '\0'; *k = '\0', *v = '\0';
assert_true(conf_procbuf(buf, k, v, len) == expect_return) && (void)(assert_true(conf_procbuf(buf, k, v, len) == expect_return) &&
assert_true(!strcmp(k, expect_key)) && assert_true(!strcmp(k, expect_key)) &&
assert_true(!strcmp(v, expect_val)); assert_true(!strcmp(v, expect_val)));
} }
void test_conf_matchopt(struct conf_entry *opts, size_t optc, const char *restrict key, int expect_index) { void test_conf_matchopt(struct conf_entry *opts, size_t optc, const char *restrict key, int expect_index) {
size_t idx = opts - conf_matchopt(opts, optc, key); size_t idx = opts - conf_matchopt(opts, optc, key);
idx = (ssize_t)idx < 0 ? -(ssize_t)idx : idx; idx = (ssize_t)idx < 0 ? -idx : idx;
int i = idx < optc ? idx : -1; int i = idx < optc ? (int)idx : -1;
assert_true(i == expect_index); assert_true(i == expect_index);
} }
@@ -40,30 +40,30 @@ void test_conf_procval_f32(const char *val, f32 expect_value) {
void test_procval_str(void) { void test_procval_str(void) {
char *out = NULL; char *out = NULL;
assert_true(!conf_procval(&(struct conf_entry){NULL, (void *)&out, CONF_STR}, "here comes the sowon")) && (void)(assert_true(!conf_procval(&(struct conf_entry){NULL, (void *)&out, CONF_STR}, "here comes the sowon")) &&
assert_false(strcmp("here comes the sowon", out)); assert_false(strcmp("here comes the sowon", out)));
free(out); free(out);
} }
void test_procval_str_predef(void) { void test_procval_str_predef(void) {
char *out = strdup("owo"); char *out = strdup("owo");
assert_true(!conf_procval(&(struct conf_entry){NULL, (void *)&out, CONF_STR}, "i leak if I don't free")) && (void)(assert_true(!conf_procval(&(struct conf_entry){NULL, (void *)&out, CONF_STR}, "i leak if I don't free")) &&
assert_true(!strcmp("i leak if I don't free", out)); assert_true(!strcmp("i leak if I don't free", out)));
free(out); free(out);
} }
void test_procval_fstr(void) { void test_procval_fstr(void) {
char buf[16]; char buf[16];
struct conf_fstr str = {sizeof(buf), buf}; struct conf_fstr str = {sizeof(buf), buf};
assert_true(!conf_procval(&(struct conf_entry){NULL, &str, CONF_FSTR}, "hewwoo wowld")) && (void)(assert_true(!conf_procval(&(struct conf_entry){NULL, &str, CONF_FSTR}, "hewwoo wowld")) &&
assert_true(!strcmp(str.out, "hewwoo wowld")); assert_true(!strcmp(str.out, "hewwoo wowld")));
} }
void test_procval_fstr_trunc(void) { void test_procval_fstr_trunc(void) {
char buf[8]; char buf[8];
struct conf_fstr str = {sizeof(buf), buf}; struct conf_fstr str = {sizeof(buf), buf};
assert_true(!conf_procval(&(struct conf_entry){NULL, &str, CONF_FSTR}, "hewwooo wowld")) && (void)(assert_true(!conf_procval(&(struct conf_entry){NULL, &str, CONF_FSTR}, "hewwooo wowld")) &&
assert_true(!strcmp(str.out, "hewwooo")); assert_true(!strcmp(str.out, "hewwooo")));
} }
void test_procval_eparse(void) { void test_procval_eparse(void) {
@@ -116,7 +116,7 @@ void test_conf_getpat(void) {
/* test with setting USERPROFILE */ /* test with setting USERPROFILE */
_putenv("USERPROFILE=C:\\Users\\test"); _putenv("USERPROFILE=C:\\Users\\test");
path = conf_getpat("\\mypath"); path = conf_getpat("\\mypath");
assert_true(path != NULL && strcmp(path, "C:\\Users\\test\\mypath") == 0); assert_true(path != NULL && strcmp(path, "C:\\Users\\test\\AppData\\Roaming\\mypath") == 0);
free(path); free(path);
/* test with setting APPDATA */ /* test with setting APPDATA */