Fun 0.41.5
The programming language that makes You have fun
Loading...
Searching...
No Matches
fun_test.c File Reference

Minimal bytecode-level test harness for core VM operations. More...

#include "bytecode.h"
#include "value.h"
#include "vm.h"
#include <math.h>
#include <stdio.h>
Include dependency graph for fun_test.c:

Go to the source code of this file.

Macros

#define ASSERT_EQ(val, expected)
 Assert that a Value is an integer equal to the expected number.

Functions

int main (void)
 Build and execute a demo bytecode program and print results.

Detailed Description

Minimal bytecode-level test harness for core VM operations.

Definition in file fun_test.c.

Macro Definition Documentation

◆ ASSERT_EQ

#define ASSERT_EQ(val,
expected )
Value:
if ((val).type != VAL_INT || (val).i != (expected)) { \
fprintf(stderr, "Assertion failed: expected %lld, got ", (long long)(expected)); \
print_value(&(val)); \
printf("\n"); \
return 1; \
}
Value val
Definition load_local.c:36
@ VAL_INT
Definition value.h:51

Assert that a Value is an integer equal to the expected number.

Prints a diagnostic and returns 1 from main on failure; used in quick sanity checks when extending this test harness.

Definition at line 27 of file fun_test.c.

Function Documentation

◆ main()

int main(void)

Build and execute a demo bytecode program and print results.

Exercises arithmetic, comparisons, logic, stack ops, rounding and transcendental functions, integer math helpers, and fmin/fmax semantics. Intended for manual inspection rather than strict unit testing.

Returns
0 on successful execution.

Definition at line 44 of file fun_test.c.

Here is the call graph for this function: