# GM Java <-> Erlang Tests The core Java libraries are all written as transform functions over data. There is little point, therefore, in obsessing over "unit tests" and "regression testing" of Java code in Java when we have cannonical code in Erlang. The purpose of this utility is to instead test the Java libraries agains the Erlang libraries directly. ## How to run In the current directory simply run `zx runlocal` and the report map will be printed to the screen and random test data will be in the `temp/` directory. To run a specific test suite run `zx runlocal [module names]`. To list module names, run `zx runlocal list`. ## Where things are The test cases are all generated in gmt.erl, generally based on randomized but valid data that are fed to reference Erlang implementations. Java code is built using plain old javac, and is handled by the `gajumaru-core/bin/compile` and `gajumaru-core/bin/run` scripts. The input to and output from each test is recorded to disk in the `temp/` dir. The inputs are then read in by equivalent Java functions and the output is then compared. For a test case to pass the outputs must be identical. ## The Erlang execution context `zx` manages loading the execution context, so dependencies like gmserialization, ec_utils, base58, etc. (all of which are targets for which is increasingly turning into a Java port) are brought in dynamically and managed by `zx`. The easiest way to test a specific function in Java against the Erlang implementation is to add a call to it in gmt.erl and a matching call in `../src/Testinator.java`. The dependencies that are brought in can be listed with `zx list deps`. The package names follow the pattern `[realm]-[package_name]-[version]` The location of the sources varies on different systems. - Linux: `$HOME/zomp/lib/[realm]/[package_name]/[version]/src` - MacOS: `$HOME/.zx/zomp/lib/[realm]/[package_name]/[version]/src` - Windows: `%%LOCALAPPDATA%%/zomp/lib/[realm]/[package_name]/[version]/src` So for example `otpr-ec_utils-1.0.0` has its sources at `~/zomp/lib/otpr/ec_utils/1.0.0/src/` on a reasonable system.