b3dacc2613
There's no "standard" coordinate system, so the choice is arbitrary. However, an examination of the Transporter mesh in Elite revealed that the mesh was designed for a left-handed coordinate system. We can compensate for that trivially in the Elite visualizer, but we might as well match what they're doing. (The only change required in the code is a couple of sign changes on the Z coordinate, and an update to the rotation matrix.) This also downsizes Matrix44 to Matrix33, exposes the rotation mode enum, and adds a left-handed ZYX rotation mode. This does mean that meshes that put the front at +Z will show their backsides initially, since we're now oriented as if we're flying the ships rather than facing them. I considered adding a 180-degree Y rotation (with a tweak to the rotation matrix handedness to correct the first rotation axis) to have them facing by default, but figured that might be confusing since +Z is supposed to be away. Anybody who really wants it to be the other way can trivially flip the coordinates in their visualizer (negate xc/zc). The Z coordinates in the visualization test project were flipped so that the design is still facing the viewer at rotation (0,0,0). |
||
---|---|---|
.. | ||
Expected | ||
FunkyProjects | ||
Source | ||
Visualization | ||
1000-allops-value-65816 | ||
1001-allops-zero-65816 | ||
1002-embedded-instructions | ||
1003-flags-and-branches | ||
1004-data-recognition | ||
2000-allops-value-6502 | ||
2000-allops-value-6502.dis65 | ||
2001-allops-zero-6502 | ||
2001-allops-zero-6502.dis65 | ||
2002-allops-value-65C02 | ||
2002-allops-value-65C02.dis65 | ||
2003-allops-zero-65C02 | ||
2003-allops-zero-65C02.dis65 | ||
2004-numeric-types | ||
2004-numeric-types.cs | ||
2004-numeric-types.dis65 | ||
2005-string-types | ||
2005-string-types.dis65 | ||
2006-operand-formats | ||
2006-operand-formats.dis65 | ||
2007-labels-and-symbols | ||
2007-labels-and-symbols.dis65 | ||
2007-labels-and-symbols.sym65 | ||
2008-address-changes | ||
2008-address-changes.dis65 | ||
2009-branches-and-banks | ||
2009-branches-and-banks.dis65 | ||
2009-branches-and-banks.sym65 | ||
2010-target-adjustment | ||
2010-target-adjustment.dis65 | ||
2011-hinting | ||
2011-hinting.cs | ||
2011-hinting.dis65 | ||
2012-label-localizer | ||
2012-label-localizer.dis65 | ||
2013-notes-and-comments | ||
2013-notes-and-comments.dis65 | ||
2014-label-dp | ||
2014-label-dp.dis65 | ||
2015-64k-nops | ||
2015-64k-nops.dis65 | ||
2016-char-encoding-a | ||
2016-char-encoding-a.dis65 | ||
2017-char-encoding-p | ||
2017-char-encoding-p.dis65 | ||
2018-char-encoding-s | ||
2018-char-encoding-s.dis65 | ||
2019-local-variables | ||
2019-local-variables.dis65 | ||
2020-cycle-counts-65816 | ||
2020-cycle-counts-65816.dis65 | ||
2021-external-symbols | ||
2021-external-symbols-1.sym65 | ||
2021-external-symbols-2.sym65 | ||
2021-external-symbols-3.sym65 | ||
2021-external-symbols.dis65 | ||
2022-extension-scripts | ||
2022-extension-scripts-a.cs | ||
2022-extension-scripts-b.cs | ||
2022-extension-scripts.dis65 | ||
2022-extension-scripts.sym65 | ||
2023-non-unique-labels | ||
2023-non-unique-labels.dis65 | ||
2024-ui-edge-cases | ||
2024-ui-edge-cases.dis65 | ||
README.md |
SourceGen Test Data
This directory contains various regression tests.
NOTE: some tests may fail if you use a version of the assembler that is different from the one used to generate the expected output. The current set was generated for:
- 64tass v1.53.1515
- ACME v0.96.4
- cc65 v2.18
- Merlin 32 v1.0
Generator/Assembler Tests
Files with names like "1000-nifty-test" are regression test data files for the code generator. The test harness identifies them by filename pattern: four digits, a hyphen, then one or more alphanumeric and hyphens. Files with a '.' or '_' are ignored.
If the leading number is between 1000 and 1999, inclusive, the test file will be loaded as a new project. A 65816 CPU and load address of $1000 are assumed. As with all new projects, the first byte will be hinted as a code entry point. The entry flags are currently set to emulation mode, but tests should not rely on that.
If the leading number is 2000 or greater, the test file will be loaded as a saved project. A file with the same name plus a ".dis65" extension will be opened as the project file.
Execution
With debug features enabled, you can open the test runner from the menu with Debug > Source Generation Tests. Click "Run Test" to run all tests.
For each test, the test harness will create a new project or open the project file. For every known assembler, the test harness will generate source code, and compare it to the corresponding entry in the Expected directory. If they don't match exactly, a failure is reported for the generation phase. (These are text files, so the line terminators are not required to match.) Next, the generated sources are fed to the appropriate cross-assembler, whether or not the sources matched expectations. If the assembler reports success, the output file is compared to the original data file. If these match, success is reported for the assembly phase.
The top window in the test harness shows a summary of success or failure. The bottom window shows details reported for each individual test. Use the drop list to select which test is shown.
The generated sources and assembled output is placed into a temporary directory inside SGTestData that is named after the test. For example, test 2000-allops-value-6502 will have all of its generated output in a directory called "tmp2000". If all parts of the test are successful, the directory will be removed. If generation or assembly fails, or if you check the "retain output" box in the test harness, the directory and its contents will remain. This allows you to examine the outputs when investigating failures.
As a safety measure, the directory will NOT be removed if it contains files that the test harness doesn't recognize.
Updating Tests
If you want to add or update a test, follow these steps:
- Make the changes to the test data file and test project file.
- Run the test harness. The generation test will fail and leave output in the tmpNNNN directory. Make sure the assembly test is succeeding.
- After verifying that the generated sources look correct, copy them into the Expected directory, replacing any existing copies.
- Run the test harness. This should now report success, and will remove the tmpNNNN directory.
Be sure to have the version of the cross-assembler identified at the top of this document configured.
Other Notes
The original source code used to generate the test cases can be found in the Source directory. The test harness does not use these files. If you want to update a test file, you will need to run the assembler yourself. The assembler used is noted in a comment at the top of the file.
The code is not required to do anything useful. Many of the test cases would crash or hang if executed.
FunkyProjects
This is a collection of project files with deliberate errors. These exist to exercise the load-time error reporting. See the README in that directory for a full explanation.
Visualization
Some test projects and data files for exercising the visualization generators. Not part of a formal test; load the projects and eyeball the results.