Mufi-Lang / MufiZ

Mufi Lang with Ziggyness
GNU General Public License v2.0
2 stars 0 forks source link

Test Suite Implementation #17

Closed Mustafif closed 4 months ago

Mustafif commented 7 months ago

In our Mars release, I shipped it with broken Vec3 functions which are now fixed in v0.7.0 but this was mainly a boolean issue. This could've been caught if we had a test suite implementation instead of random test files.

Here's my proposition:

test_suite/
      vec/
          slice.mufi
          splice.mufi 
          ops.mufi
          ....

On the Zig side:

// src/test_suite.zig
test "slice vec3"{
        // run interpret to check if an error occurs 
} 

This will involve making runtime and compile errors, an error union in Zig so we can properly see if tests fail or pass. This will allow us to utilize Zig Unit Testing to create a nice framework.

Mustafif commented 7 months ago

When running a file, Mufi's compile and runtime error will be treated as a Zig error Done in this commit: https://github.com/Mustafif/MufiZ/commit/4f7f9fdaf69ec6d64da16d5733622b050e342fa1

Mustafif commented 7 months ago

Edit to initial proposal, we will need to store all tests in src/main.zig so all unit tests are available.

Mustafif commented 7 months ago

A python script has been made to do the "unit testing" and report successful and failed tests. The initial support has been made in https://github.com/Mustafif/MufiZ/commit/52d932d5e018dfa33109f2838628eddec1d4eaa2 . We will look at more ways to make this script smarter and help us with debugging. We also need to grow all the tests in this suite.

Mustafif commented 7 months ago

What needs to be added:

Vector

Array

Linked List

Hash Table