From db72606b08fa9338aefaea5fa8100b5bcccd0312 Mon Sep 17 00:00:00 2001 From: Sabine Date: Thu, 19 Jan 2023 14:08:00 +0100 Subject: [PATCH] chore(developer): restored kmcompxtest, adapted readme --- common/test/keyboards/invalid/README.md | 25 +++++++------- core/tests/unit/kmx/kmx_imsample.kmx | Bin 888 -> 0 bytes core/tests/unit/kmx/kmx_key_list.kmx | Bin 806 -> 0 bytes developer/src/kmcmplib/tests/kmcompxtest.cpp | 33 +++++++------------ 4 files changed, 25 insertions(+), 33 deletions(-) delete mode 100644 core/tests/unit/kmx/kmx_imsample.kmx delete mode 100644 core/tests/unit/kmx/kmx_key_list.kmx diff --git a/common/test/keyboards/invalid/README.md b/common/test/keyboards/invalid/README.md index 897d7d6622..7cd5ffc5ab 100644 --- a/common/test/keyboards/invalid/README.md +++ b/common/test/keyboards/invalid/README.md @@ -1,9 +1,9 @@ # **Tests for kmcompxtest()**
-This folder contains several kmn-files that are used for testing resulting Errorcodes. +This folder contains several kmn-files that are used for testing resulting error codes. -Most of these tests are copied from balochi_phonetic and contain alterations of the data to produce (at least) 1 Error. +Most of these tests are copied from balochi_phonetic and contain alterations of the data to produce (at least) 1 error.

@@ -20,24 +20,27 @@ The naming convention of the files is as follows: * After the second underscore all combination of char can be used. -* The 4 characters following CERR_ correspond to the last 4 digits of the Error-Code which is expected to be produced by this file. +* The 4 characters following CERR_ correspond to the last 4 digits of the error-Code which is expected to be produced by this file. - ( e.g. CERR_404D_balochi_phonetic.kmn should produce Error 0x0000404D). + ( e.g. CERR_404D_balochi_phonetic.kmn should produce error 0x0000404D).
---
-While running kmcompxtest extracts the 4 chars from the Filename and compares them to the actual Error found. +While running, kmcompxtest extracts those 4 characters from the Filename (e.g. 404D for CERR_404D_balochi_phonetic) and compares those to the actual error found. -* If they correspond the test will be marked as OK. (Code 0) +* If these 4 characters correspond to the actual error given, the test will be marked as OK. (Code 0) +
+* If these 4 characters signifiy an error but **no error** does occur, the test will be marked as FAILED (Code 1) +
+* If these 4 characters signifiy an error but this **specific error** does not occur, the test will be marked as FAILED (Code 4) +
+* If these 4 characters signifiy an error number that is **not correct**, the test will be marked as FAILED (Code 5) +
+* If more than 1 error is produced, only the error coded in the Filename will be detected -* If the file is supposed to produce an Error and does not the test will be marked as FAILED (Code 1) - -* If the filename is not correct the test will be marked as FAILED (Code 1) - -* If more than 1 Error is produced only the Error coded in the Filename will be detected ### Tests are available for the following CERR_: diff --git a/core/tests/unit/kmx/kmx_imsample.kmx b/core/tests/unit/kmx/kmx_imsample.kmx deleted file mode 100644 index 754c0985ae2bf73e99d134f34a1254319968f309..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 888 zcmaizyGnyW5QR?^FCa$oT4<3?%$=b!s4GxaT@8Fd%ygi0GU{$kLJNv(79_Q(gyS4V z#O(WirWgJE)Q^3{el>P2Fg7@^#JVEBs%5Ikl9|yqzpO4f^_XhI^Z&{#`?blo**0T0 zt-IUXy}nNU$ewGPZ8QI6&$rFCnFK#+gSU#gH?L5Ov;T;I zd{_@80_+=x`&lxu6urm4- tq~OCYB3021kVaeAnFZ)8&}t2+%SDXwH^Pir)giNLxq&OL!;PJ8dMZczXL diff --git a/core/tests/unit/kmx/kmx_key_list.kmx b/core/tests/unit/kmx/kmx_key_list.kmx deleted file mode 100644 index efb6540fcec6057653b03180095b2da757b0c222..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 806 zcmZvaxk>|J6opTWf{4ZxZbXqm#8Q&r3Kl~mqzJJwf^8PTh#HA8E_I3&78Zgc7CwTd zPasy-7Gfb5V&N;q?@mSu>JQ)CbI$!YW+uI!T~&`1db~IgBVZ2(k%HjD17VYa{25c$ zWDG)t{vCA)9P}6rqodRb=teJ5;}Aw?sVlzTq85F9Laq9`L9P4xhI$19ti7k+LQ)lN zD5omVq8uHngx*A@NshHcZx^?WtHHL)+M`y;%vZF}in2E+rddrZ3USRT=4p;1vC+Pt z`ItA;dQ-o4YW1WPGaO~OL5ck>UF4afI%K>D&3HbJ&!ZL~p*7}~RNziU?q{p!d1n6X z_5WQ*I(XL*1{<9afJ^+fpIL67&GHYj&$is8<;`Z7Ot;@&>LrmYRcO^9j_vcaBYYha z_z*a*)WDxY65kIl*%|&Ea(Fu@=$&Qv$@^HR09L=T|I5Y`E1w~O_Wm.kmx - */ FILE* fp2 = fopen(fname, "rb"); - if (!fp2) return 0; //assume pass if no reference kmx file + if (!fp2) return 0; // exit code 0: assume pass if no reference kmx file in build-folder fseek(fp1, 0, SEEK_END); auto sz1 = ftell(fp1); @@ -82,15 +70,16 @@ int main(int argc, char *argv[]) fseek(fp2, 0, SEEK_END); auto sz2 = ftell(fp2); fseek(fp2, 0, SEEK_SET); - if (sz1 != sz2) return 2; + if (sz1 != sz2) return 2; // exit code 2: size of kmx-file in build differs from size of kmx-file in source folder char* buf1 = new char[sz1]; char* buf2 = new char[sz1]; fread(buf1, 1, sz1, fp1); fread(buf2, 1, sz1, fp2); - return memcmp(buf1, buf2, sz1) ? 3 : 0; + return memcmp(buf1, buf2, sz1) ? 3 : 0; // exit code 3: when contents of kmx-file in build differs from contents of kmx-file in source folder + // exit code 0: when contents of kmx-file in build and source folder are the same } - else /*if Errors found check number (e.g. CERR_4061_balochi_phonetic.kmn should produce Error 4061)*/ + else /*if Errors found: check number (e.g. CERR_4061_balochi_phonetic.kmn should produce Error 4061)*/ { int error_val = 0; char* testname = strrchr( (char*) kmn_file, '\\') + 1; @@ -104,12 +93,12 @@ int main(int argc, char *argv[]) // check if error_val is in Array of Errors; if it is found return 0 (it's not an error) for (int i = 0; i < error_vec.size() ; i++) { if (error_vec[i] == error_val) - return 0; + return 0; // exit code 0: CERR_ in Name + Error (specified in CERR_Name) IS found } - return 4; + return 4; // exit code 4: CERR_ in Name + Error (specified in CERR_Name) is NOT found } else - return 1; // no CERR_ in Name => CompileKeyboardFile failed + return 5; // exit code 5: no correct CERR_ in Name + CompileKeyboardFile failed } - return 1; + return 6; // exit code 6: else }