test: expand golden C-codegen tests from 2 to 8 examples
Add golden tests for: structs, generics, algebraic_enums, enums, methods, strings. Each test captures the expected C output from the bootstrap compiler for regression detection. Also remove leftover 'PARSER FIX V2 ACTIVE' debug print from parser.bux.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
// Generics - Generic functions and structs
|
||||
import Std::Io::{PrintLine, PrintInt};
|
||||
|
||||
|
||||
func Max<T>(a: T, b: T) -> T {
|
||||
if a > b {
|
||||
return a;
|
||||
} else {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
func Main() -> int {
|
||||
let m1: int = Max<int>(10, 20);
|
||||
let m2: int = Max<int>(5, 3);
|
||||
|
||||
PrintLine("Max(10, 20) = ");
|
||||
PrintInt(m1);
|
||||
PrintLine("");
|
||||
|
||||
PrintLine("Max(5, 3) = ");
|
||||
PrintInt(m2);
|
||||
PrintLine("");
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user