Files
Toy/tests
Kayne Ruse d3b59eb0da WIP functions working, untested, memory issues, read more
I've ripped out the deep copying, and flattened the bucket usage, but
this results in no memory being freed or reused for the lifetime of the
program.

This is shown most clearly with this script:

```toy
fn makeCounter() {
	var counter: int = 0;

	fn increment() {
		return ++counter;
	}

	return increment;
}

var tally = makeCounter();

while (true) {
	var result = tally();

	if (result >= 10_000_000) {
		break;
	}
}
```

The number of calls vs amount of memory consumed is:

```
function calls -> memory used in megabytes
1_000 -> 0.138128
10_000 -> 2.235536
100_000 -> 21.7021
1_000_000 -> 216.1712
10_000_000 -> 1520.823
```

Obviously this needs to be fixed, as ballooning to gigabytes of memory
in only a moment isn't practical. That will be the next task - to find
some way to free memory that isn't needed anymore.

See #163, #160
2025-02-21 11:41:27 +11:00
..
2024-12-11 17:07:49 +11:00

Test Instructions

To run these tests, execute one of the following commands from the repo's root:

make tests
make tests-gdb
make tests-valgrind

Benchmarks

For testing and comparing different potential solutions. These may be left in an incomplete state, so they might not work out of the box.

Cases

For testing individual pieces of the source code in isolation. These are essentially the unit tests, and are used by the CI pipeline.

Integrations

For testing Toy's processes as a complete whole. This will automatically build the repl, and is used by the CI pipeline.

Mustfails

These have situations which will raise errors of some kind, to ensure that common user errors are handled gracefully. This is not yet implemented.

Standalone

These are one-file programs that are not intended to test the source directly. Instead, these can cover a number of situations, such as the exact behavior of GitHub's workflow runners, or to generate repetitive code predictably, etc.