Update manuals and other additions

This commit is contained in:
2026-06-09 12:45:33 -05:00
parent 051b12f28d
commit 78fb8d6d7c
101 changed files with 1629 additions and 401 deletions
+9 -9
View File
@@ -15,40 +15,40 @@ def _transpile_example(name: str) -> str:
def test_transpile_factorial_contains_procedure():
c = _transpile_example("intro_1_3_factorial.protel")
c = _transpile_example("intro_1_3_factorial.P")
assert "int16_t factorial(" in c
assert "while (" in c
assert "return result;" in c
def test_transpile_types_emits_typedefs():
c = _transpile_example("intro_2_1_types.protel")
c = _transpile_example("intro_2_1_types.P")
assert "typedef int16_t integer;" in c
assert "typedef int16_t digit_register[16];" in c
assert "seconds_per_hour" in c
def test_transpile_assignment_maps_arrow_to_equals():
c = _transpile_example("intro_2_2_calculate_average.protel")
c = _transpile_example("intro_2_2_calculate_average.P")
assert "average =" in c
assert "return average;" in c
def test_transpile_case_emits_switch():
c = _transpile_example("intro_3_2_4_case.protel")
c = _transpile_example("intro_3_2_4_case.P")
assert "switch (n)" in c
assert "case 0:" in c
assert "default:" not in c
def test_transpile_for_emits_c_for_loop():
c = _transpile_example("intro_3_2_6_sum_table.protel")
c = _transpile_example("intro_3_2_6_sum_table.P")
assert "for (int32_t i = 0;" in c
assert "return sum;" in c
def test_transpile_struct_emits_fields():
c = _transpile_example("ref_8_1_task_block_struct.protel")
c = _transpile_example("ref_8_1_task_block_struct.P")
assert "typedef struct {" in c
assert "uint8_t priority;" in c
assert "uint8_t completed;" in c
@@ -56,7 +56,7 @@ def test_transpile_struct_emits_fields():
def test_transpile_class_type_emits_static_class_var():
c = _transpile_example("ref_oo_class_with_var.protel")
c = _transpile_example("ref_oo_class_with_var.P")
assert "typedef struct class_with_var_t" in c
assert "static int16_t class_with_var_class_var" in c
assert "void class_with_var_class_method(int16_t parameter)" in c
@@ -64,12 +64,12 @@ def test_transpile_class_type_emits_static_class_var():
def test_transpile_class_method_invocation():
c = _transpile_example("ref_oo_class_method_invoke.protel")
c = _transpile_example("ref_oo_class_method_invoke.P")
assert "class_with_class_method_class_method(5)" in c
assert "class_with_class_method_class_method(6)" in c
def test_transpile_emits_header():
c = _transpile_example("intro_1_3_factorial.protel")
c = _transpile_example("intro_1_3_factorial.P")
assert "Generated by PROTEL 2026 transpiler" in c
assert "#include <stdint.h>" in c