From e44d5e1b3428eeae2bd1b82b71a441ed0a6c094a Mon Sep 17 00:00:00 2001 From: AwesomeAdam54321 Date: Sat, 9 Mar 2024 12:06:34 +0800 Subject: [PATCH] foundation-test: Sections: Nowebify. --- .../{Program Control.w => Program Control.nw} | 27 +++++----- .../Sections/{Unit Tests.w => Unit Tests.nw} | 50 +++++++++---------- 2 files changed, 39 insertions(+), 38 deletions(-) rename foundation-test/Sections/{Program Control.w => Program Control.nw} (88%) rename foundation-test/Sections/{Unit Tests.w => Unit Tests.nw} (97%) diff --git a/foundation-test/Sections/Program Control.w b/foundation-test/Sections/Program Control.nw similarity index 88% rename from foundation-test/Sections/Program Control.w rename to foundation-test/Sections/Program Control.nw index 9da4578..cc98361 100644 --- a/foundation-test/Sections/Program Control.w +++ b/foundation-test/Sections/Program Control.nw @@ -2,22 +2,23 @@ Choosing which unit test to run on the basis of the command-line arguments. -@h Main routine. +@ \section{Main routine.} -@d PROGRAM_NAME "foundation-test" +<<*>>= +#define PROGRAM_NAME "foundation-test" -@e TEST_STRINGS_CLSW -@e TEST_RE_CLSW -@e TEST_DICT_CLSW -@e TEST_LITERALS_CLSW -@e TEST_REPLACEMENT_CLSW -@e TEST_LISTS_CLSW -@e TEST_STACKS_CLSW -@e TEST_SEMVER_CLSW -@e TEST_TREES_CLSW -@e TEST_JSON_CLSW +enum TEST_STRINGS_CLSW +enum TEST_RE_CLSW +enum TEST_DICT_CLSW +enum TEST_LITERALS_CLSW +enum TEST_REPLACEMENT_CLSW +enum TEST_LISTS_CLSW +enum TEST_STACKS_CLSW +enum TEST_SEMVER_CLSW +enum TEST_TREES_CLSW +enum TEST_JSON_CLSW -= +<<*>>= int main(int argc, char **argv) { Foundation::start(argc, argv); CommandLine::declare_heading(L"inexample: a tool for testing foundation facilities\n"); diff --git a/foundation-test/Sections/Unit Tests.w b/foundation-test/Sections/Unit Tests.nw similarity index 97% rename from foundation-test/Sections/Unit Tests.w rename to foundation-test/Sections/Unit Tests.nw index db5d4d8..570a223 100644 --- a/foundation-test/Sections/Unit Tests.w +++ b/foundation-test/Sections/Unit Tests.nw @@ -2,9 +2,9 @@ A selection of tests for, or demonstrations of, foundation features. -@h Strings. +@ \section{Strings.} -= +<<*>>= void Unit::test_strings(void) { text_stream *S = Str::new_from_wide_string(L"Jack and Jill"); PRINT("Setup: %S\n", S); @@ -36,9 +36,9 @@ void Unit::test_strings(void) { PRINT("%S ci-ne %S? %d\n", A, B, Str::ne_insensitive(A, B)); } -@h Literals. +@ \section{Literals.} -= +<<*>>= void Unit::test_literals(void) { LOG("This is \"tricky"); LOG("%S", I"bananas"); int z = '"'; LOG("%S%d", I"peaches", z); @@ -52,9 +52,9 @@ void Unit::test_literals(void) { else PRINT("and A == B as pointers, too\n"); } -@h Dictionaries. +@ \section{Dictionaries.} -= +<<*>>= void Unit::test_dictionaries(text_stream *arg) { dictionary *D = Dictionaries::new(2, TRUE); Dictionaries::log(STDOUT, D); @@ -103,9 +103,9 @@ void Unit::test_dictionaries_helper2(text_stream *text, text_file_position *tfp, Errors::in_text_file("test case won't parse", tfp); } -@h Regexp. +@ \section{Regexp.} -= +<<*>>= void Unit::test_regexp(text_stream *arg) { filename *F = Filenames::from_text(arg); TextFiles::read(F, FALSE, "unable to read file of test cases", TRUE, @@ -135,9 +135,9 @@ void Unit::test_regexp_helper(text_stream *text, text_file_position *tfp, void * Errors::in_text_file("test case won't parse", tfp); } -@h Replacements. +@ \section{Replacements.} -= +<<*>>= void Unit::test_replacement(text_stream *arg) { filename *F = Filenames::from_text(arg); TextFiles::read(F, FALSE, "unable to read file of test cases", TRUE, @@ -161,9 +161,9 @@ void Unit::test_replacement_helper(text_stream *text, text_file_position *tfp, v Errors::in_text_file("test case won't parse", tfp); } -@h Linked lists. +@ \section{Linked lists.} -= +<<*>>= void Unit::test_linked_lists(void) { linked_list *test_list = NEW_LINKED_LIST(text_stream); PRINT("List (which should be empty) contains:\n"); @@ -186,9 +186,9 @@ void Unit::test_linked_lists(void) { PRINT("Last is: %S\n", LAST_IN_LINKED_LIST(text_stream, test_list)); } -@h Stacks. +@ \section{Stacks.} -= +<<*>>= void Unit::test_stacks(void) { lifo_stack *test_stack = NEW_LIFO_STACK(text_stream); PRINT("Top of stack is: %S\n", TOP_OF_LIFO_STACK(text_stream, test_stack)); @@ -213,9 +213,9 @@ void Unit::test_stacks(void) { if (LIFO_STACK_EMPTY(text_stream, test_stack)) PRINT("Stack is empty\n"); } -@h Semantic versions. +@ \section{Semantic versions.} -= +<<*>>= void Unit::test_range(OUTPUT_STREAM, text_stream *text) { semantic_version_number V = VersionNumbers::from_text(text); semver_range *R = VersionNumberRanges::compatibility_range(V); @@ -316,16 +316,16 @@ void Unit::test_semver(void) { Unit::test_intersect(STDOUT, I"6.4.2", -1, I"3.5.5", -1); } -@h Trees. +@ \section{Trees.} -@e prince_CLASS -@e princess_CLASS +enum prince_CLASS +enum princess_CLASS -= +<<*>>= DECLARE_CLASS(prince) DECLARE_CLASS(princess) -@ = +<<*>>= typedef struct prince { struct text_stream *boys_name; CLASS_DEFINITION @@ -339,7 +339,7 @@ typedef struct princess { tree_node_type *M = NULL, *F = NULL; -@ = +<<*>>= void Unit::test_trees(void) { tree_type *TT = Trees::new_type(I"royal family", &Unit::verifier); heterogeneous_tree *royalty = Trees::new(TT); @@ -393,7 +393,7 @@ int Unit::princess_verifier(tree_node *N) { return TRUE; } -@ = +<<*>>= void Unit::show_tree(text_stream *OUT, heterogeneous_tree *T) { WRITE("%S\n", T->type->name); INDENT; @@ -415,9 +415,9 @@ int Unit::visit(tree_node *N, void *state, int L) { return TRUE; } -@h JSON. +@ \section{JSON.} -= +<<*>>= dictionary *known_JSON_reqs = NULL; void Unit::test_JSON(text_stream *arg) {