|
||
---|---|---|
.. | ||
README.md | ||
addition.c.must_have | ||
addition.out | ||
addition.vv | ||
assert_fncalls.c.must_have | ||
assert_fncalls.out | ||
assert_fncalls.vv | ||
check_combination_of_alias_and_sumtype.c.must_have | ||
check_combination_of_alias_and_sumtype.vv | ||
comp_if_unknown.c.must_have | ||
comp_if_unknown.vv | ||
compare_structs.c.must_have | ||
compare_structs.vv | ||
console_windows_program.c.must_have | ||
console_windows_program.vv | ||
const_references.c.must_have | ||
const_references.out | ||
const_references.vv | ||
embed.c.must_have | ||
embed.vv | ||
embed_with_prod.c.must_have | ||
embed_with_prod.out | ||
embed_with_prod.vv | ||
embed_with_prod_and_several_decoders.c.must_have | ||
embed_with_prod_and_several_decoders.out | ||
embed_with_prod_and_several_decoders.vv | ||
embed_with_prod_zlib.c.must_have | ||
embed_with_prod_zlib.out | ||
embed_with_prod_zlib.vv | ||
enum_switch_case.c.must_have | ||
enum_switch_case.out | ||
enum_switch_case.vv | ||
export_and_weak.c.must_have | ||
export_and_weak.out | ||
export_and_weak.vv | ||
for_in.c.must_have | ||
for_in.out | ||
for_in.vv | ||
globals_with_weak_tag.c.must_have | ||
globals_with_weak_tag.vv | ||
gui_windows_program.c.must_have | ||
gui_windows_program.vv | ||
gui_windows_program_with_console_tag.c.must_have | ||
gui_windows_program_with_console_tag.vv | ||
strlit_len_optimization.c.must_have | ||
strlit_len_optimization.out | ||
strlit_len_optimization.vv | ||
volatile.c.must_have | ||
volatile.out | ||
volatile.vv |
README.md
Purpose: tests data for the output of V's C code generator
TLDR: v run vlib/v/gen/c/coutput_test.v
coutput_test.v is a test runner, that checks whether the generated C source code matches all expectations, specified in *.c.must_have files, in the folder vlib/v/gen/c/testdata/ .
Each .c.must_have
file, has to have a corresponding .vv
file.
Each .c.must_have
file, consists of multiple lines. Each of these
lines, should be present at least once in the output, when the .vv
file is compiled with -o -
.
Note: this test runner can also be used to verify and keep from regressing
partial fixes to V's checker, i.e. ones that make a program type check fine,
but that still lead to codegen problems. To do that, put the V code that the
checker can typecheck in a .vv
file in this folder, then create a
corresponding .c.must_have
file in this folder too. It should have a single
line in it: // THE END.
. The V codegen will end every source that it
generates with that line, so its presence, effectively guarantees that cgen
succeeded/ended, even if the produced C code can not be compiled yet.