From 9251e06143af437d919c5b9f639b746905708303 Mon Sep 17 00:00:00 2001 From: Yawning Angel Date: Fri, 16 Feb 2024 18:55:26 +0900 Subject: [PATCH] tests/core: Bring the Makefile more in-sync with build.bat --- .gitignore | 1 + tests/core/Makefile | 50 +++++++++++-------- tests/core/c/libc/test_core_libc.odin | 1 - .../core/text/match/test_core_text_match.odin | 7 ++- 4 files changed, 34 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index a5ddfe670..228f006a3 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ tests/internal/test_map tests/internal/test_pow tests/internal/test_rtti tests/core/test_core_compress +tests/core/test_core_container tests/core/test_core_filepath tests/core/test_core_fmt tests/core/test_core_i18n diff --git a/tests/core/Makefile b/tests/core/Makefile index 35321696f..1207eeec5 100644 --- a/tests/core/Makefile +++ b/tests/core/Makefile @@ -1,8 +1,11 @@ ODIN=../../odin PYTHON=$(shell which python3) +COMMON=-vet -strict-style +COLLECTION=-collection:tests=.. all: c_libc_test \ compress_test \ + container_test \ crypto_test \ download_test_assets \ encoding_test \ @@ -27,64 +30,67 @@ download_test_assets: $(PYTHON) download_assets.py image_test: - $(ODIN) run image/test_core_image.odin -file -out:test_core_image + $(ODIN) run image $(COMMON) -out:test_core_image compress_test: - $(ODIN) run compress/test_core_compress.odin -file -out:test_core_compress + $(ODIN) run compress $(COMMON) -out:test_core_compress + +container_test: + $(ODIN) run container $(COMMON) $(COLLECTION) -out:test_core_container strings_test: - $(ODIN) run strings/test_core_strings.odin -file -out:test_core_strings + $(ODIN) run strings $(COMMON) -out:test_core_strings hash_test: - $(ODIN) run hash -o:speed -no-bounds-check -out:test_hash + $(ODIN) run hash $(COMMON) -o:speed -no-bounds-check -out:test_hash crypto_test: - $(ODIN) run crypto -o:speed -no-bounds-check -out:test_crypto + $(ODIN) run crypto $(COMMON) -o:speed -no-bounds-check -out:test_crypto noise_test: - $(ODIN) run math/noise -out:test_noise + $(ODIN) run math/noise $(COMMON) -out:test_noise encoding_test: - $(ODIN) run encoding/hxa -out:test_hxa -collection:tests=.. - $(ODIN) run encoding/json -out:test_json - $(ODIN) run encoding/varint -out:test_varint - $(ODIN) run encoding/xml -out:test_xml + $(ODIN) run encoding/hxa $(COMMON) $(COLLECTION) -out:test_hxa + $(ODIN) run encoding/json $(COMMON) -out:test_json + $(ODIN) run encoding/varint $(COMMON) -out:test_varint + $(ODIN) run encoding/xml $(COMMON) -out:test_xml math_test: - $(ODIN) run math/test_core_math.odin -file -collection:tests=.. -out:test_core_math + $(ODIN) run math $(COMMON) $(COLLECTION) -out:test_core_math linalg_glsl_math_test: - $(ODIN) run math/linalg/glsl/test_linalg_glsl_math.odin -file -collection:tests=.. -out:test_linalg_glsl_math + $(ODIN) run math/linalg/glsl $(COMMON) $(COLLECTION) -out:test_linalg_glsl_math filepath_test: - $(ODIN) run path/filepath/test_core_filepath.odin -file -collection:tests=.. -out:test_core_filepath + $(ODIN) run path/filepath $(COMMON) $(COLLECTION) -out:test_core_filepath reflect_test: - $(ODIN) run reflect/test_core_reflect.odin -file -collection:tests=.. -out:test_core_reflect + $(ODIN) run reflect $(COMMON) $(COLLECTION) -out:test_core_reflect slice_test: - $(ODIN) run slice/test_core_slice.odin -file -out:test_core_slice + $(ODIN) run slice $(COMMON) -out:test_core_slice os_exit_test: $(ODIN) run os/test_core_os_exit.odin -file -out:test_core_os_exit && exit 1 || exit 0 i18n_test: - $(ODIN) run text/i18n -out:test_core_i18n + $(ODIN) run text/i18n $(COMMON) -out:test_core_i18n match_test: - $(ODIN) run text/match -out:test_core_match + $(ODIN) run text/match $(COMMON) -out:test_core_match c_libc_test: - $(ODIN) run c/libc -out:test_core_libc + $(ODIN) run c/libc $(COMMON) -out:test_core_libc net_test: - $(ODIN) run net -out:test_core_net + $(ODIN) run net $(COMMON) -out:test_core_net fmt_test: - $(ODIN) run fmt -out:test_core_fmt + $(ODIN) run fmt $(COMMON) -out:test_core_fmt thread_test: - $(ODIN) run thread -out:test_core_thread + $(ODIN) run thread $(COMMON) -out:test_core_thread runtime_test: - $(ODIN) run runtime -out:test_core_runtime + $(ODIN) run runtime $(COMMON) -out:test_core_runtime diff --git a/tests/core/c/libc/test_core_libc.odin b/tests/core/c/libc/test_core_libc.odin index 6ad37ac6d..9b5014dee 100644 --- a/tests/core/c/libc/test_core_libc.odin +++ b/tests/core/c/libc/test_core_libc.odin @@ -2,7 +2,6 @@ package test_core_libc import "core:fmt" import "core:os" -import "core:strings" import "core:testing" TEST_count := 0 diff --git a/tests/core/text/match/test_core_text_match.odin b/tests/core/text/match/test_core_text_match.odin index 79defb849..b72190f78 100644 --- a/tests/core/text/match/test_core_text_match.odin +++ b/tests/core/text/match/test_core_text_match.odin @@ -202,8 +202,11 @@ test_captures :: proc(t: ^testing.T) { // match all captures compare_captures :: proc(t: ^testing.T, test: ^Temp, haystack: string, comp: []string, loc := #caller_location) { length, err := match.find_aux(haystack, test.pattern, 0, false, &test.captures) - if failed(t, len(comp) == length) { - logf(t, "Captures Compare Failed -> Lengths %d != %d\n", len(comp), length) + result := len(comp) == length && err == .OK + if failed(t, result == true) { + logf(t, "Captures Compare Failed!\n") + logf(t, "\tErr: %v\n", err) + logf(t, "\tLengths: %v != %v\n", len(comp), length) } for i in 0..