1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-12-01 22:50:35 +00:00
6502bench/SourceGen/SGTestData
Andy McFadden 4322a0c231 Add option to put labels on separate lines
We currently have two options for assembly code output, selected by
a checkbox in the application settings: always put labels on the same
lines as the instruction or data operand, or split the labels onto
their own line if they were wider than the label text field.

This change adds a third option, which puts labels on their own line
whenever possible.  Assemblers don't generally allow this for variable
assignment pseudo-ops like "foo = $1000", but it's accepted for most
other situations.  This is a cosmetic change to the output, and will
not affect the generated code.

The old true/false app setting will be disregarded.  "Split if too
long" will be used by default.

Added test 20280-label-placement to exercise the "split whenever
allowed" behavior.

The "export" function has a similar option that has not been updated
(for no particular reason other than laziness).

Also, simplified the app settings GetEnum / SetEnum calls, which
can infer the enumerated type from the arguments.  This should not
impact behavior.
2024-04-21 16:26:42 -07:00
..
Expected Add option to put labels on separate lines 2024-04-21 16:26:42 -07:00
FunkyProjects Add a couple of funky projects 2021-10-08 08:36:44 -07:00
Source Add option to put labels on separate lines 2024-04-21 16:26:42 -07:00
Visualization Fix lastOffset calculations in Apple II hi-res visualizer 2021-05-17 17:28:13 -07:00
10000-allops-value-6502 Regression test rework, part 1 2020-06-06 14:47:19 -07:00
10001-allops-value-65C02 Regression test rework, part 1 2020-06-06 14:47:19 -07:00
10002-allops-value-65816 Regression test rework, part 1 2020-06-06 14:47:19 -07:00
10003-allops-value-W65C02 Add W65C02S support, part 3 2020-10-11 14:35:17 -07:00
10010-allops-zero-6502 Regression test rework, part 1 2020-06-06 14:47:19 -07:00
10011-allops-zero-65C02 Regression test rework, part 1 2020-06-06 14:47:19 -07:00
10012-allops-zero-65816 Regression test rework, part 1 2020-06-06 14:47:19 -07:00
10013-allops-zero-W65C02 Add W65C02S support, part 3 2020-10-11 14:35:17 -07:00
10020-embedded-instructions Refactor tests 1002x and 1003x 2020-10-18 20:30:42 -07:00
10022-embedded-instructions Refactor tests 1002x and 1003x 2020-10-18 20:30:42 -07:00
10030-flags-and-branches Refactor tests 1002x and 1003x 2020-10-18 20:30:42 -07:00
10032-flags-and-branches Refactor tests 1002x and 1003x 2020-10-18 20:30:42 -07:00
10040-data-recognition Rename test 10042 2020-10-18 09:16:50 -07:00
20000-numeric-types Add "uninitialized data" format type 2021-10-13 15:05:07 -07:00
20000-numeric-types.cs Regression test rework, part 1 2020-06-06 14:47:19 -07:00
20000-numeric-types.dis65 Add "uninitialized data" format type 2021-10-13 15:05:07 -07:00
20010-string-types Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20010-string-types.dis65 Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20020-operand-formats Split 2002x-operand-formats test 2020-06-08 17:47:26 -07:00
20020-operand-formats.dis65 Split 2002x-operand-formats test 2020-06-08 17:47:26 -07:00
20022-operand-formats Split 2002x-operand-formats test 2020-06-08 17:47:26 -07:00
20022-operand-formats.dis65 Split 2002x-operand-formats test 2020-06-08 17:47:26 -07:00
20030-labels-and-symbols Regression test rework, part 3 2020-06-06 17:06:31 -07:00
20030-labels-and-symbols.dis65 Regression test rework, part 3 2020-06-06 17:06:31 -07:00
20030-labels-and-symbols.sym65 Regression test rework, part 3 2020-06-06 17:06:31 -07:00
20032-labels-and-symbols Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20032-labels-and-symbols.dis65 Data Bank Register management, part 6 (of 6) 2020-07-10 15:53:43 -07:00
20040-address-changes Improve handling of C64 PRG header 2020-10-17 16:45:13 -07:00
20040-address-changes.dis65 Improve handling of C64 PRG header 2020-10-17 16:45:13 -07:00
20042-address-changes Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20042-address-changes.dis65 Improve handling of C64 PRG header 2020-10-17 16:45:13 -07:00
20050-branches-and-banks Regression test rework, part 4 2020-06-06 17:30:50 -07:00
20050-branches-and-banks.dis65 Regression test rework, part 4 2020-06-06 17:30:50 -07:00
20050-branches-and-banks.sym65 Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20052-branches-and-banks Fix 64tass code gen corner case 2021-08-09 14:11:15 -07:00
20052-branches-and-banks.dis65 Fix 64tass code gen corner case 2021-08-09 14:11:15 -07:00
20060-target-adjustment Refactor 2006x-target-adjustment 2020-10-19 15:46:05 -07:00
20060-target-adjustment.dis65 Refactor 2006x-target-adjustment 2020-10-19 15:46:05 -07:00
20062-target-adjustment Refactor 2006x-target-adjustment 2020-10-19 15:46:05 -07:00
20062-target-adjustment.dis65 Refactor 2006x-target-adjustment 2020-10-19 15:46:05 -07:00
20070-hinting Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20070-hinting.cs Change some words 2020-10-23 10:50:36 -07:00
20070-hinting.dis65 Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20081-label-localizer Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20081-label-localizer.dis65 Don't use "not" as a label in ACME output 2021-10-18 13:04:10 -07:00
20090-notes-and-comments Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20090-notes-and-comments.dis65 Fix trailing backslash issue 2021-11-04 15:11:59 -07:00
20100-label-dp Add 20100-label-dp test 2020-10-19 16:02:28 -07:00
20100-label-dp.dis65 Add 20100-label-dp test 2020-10-19 16:02:28 -07:00
20102-label-dp Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20102-label-dp.dis65 Rename test 10042 2020-10-18 09:16:50 -07:00
20110-64k-nops Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20110-64k-nops.dis65 Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20120-char-encoding-a Fix DCI string edge case 2021-08-10 14:08:39 -07:00
20120-char-encoding-a.dis65 Fix DCI string edge case 2021-08-10 14:08:39 -07:00
20122-char-encoding Rework 201XX-char-encoding-X tests 2020-10-19 15:01:02 -07:00
20122-char-encoding.dis65 Rework 201XX-char-encoding-X tests 2020-10-19 15:01:02 -07:00
20130-char-encoding-p Fix DCI string edge case 2021-08-10 14:08:39 -07:00
20130-char-encoding-p.dis65 Fix DCI string edge case 2021-08-10 14:08:39 -07:00
20140-char-encoding-s Fix DCI string edge case 2021-08-10 14:08:39 -07:00
20140-char-encoding-s.dis65 Fix DCI string edge case 2021-08-10 14:08:39 -07:00
20150-local-variables Clone 20152-local-variables 2020-10-19 17:14:56 -07:00
20150-local-variables.dis65 Clone 20152-local-variables 2020-10-19 17:14:56 -07:00
20152-local-variables Expand 20152-local-variables test 2021-07-20 11:28:26 -07:00
20152-local-variables.dis65 Expand max local variable width to 257 2021-07-20 13:08:19 -07:00
20162-cycle-counts-65816 Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20162-cycle-counts-65816.dis65 Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20170-external-symbols Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20170-external-symbols-1.sym65 Allow leading whitespace in .sym65 comments 2021-10-24 14:12:45 -07:00
20170-external-symbols-2.sym65 Minor fix for 24-bit MULTI_MASK 2020-11-03 11:47:53 -08:00
20170-external-symbols-3.sym65 Minor fix for 24-bit MULTI_MASK 2020-11-03 11:47:53 -08:00
20170-external-symbols.dis65 ORG rework, part 9 2021-10-07 12:39:30 -07:00
20172-external-symbols Minor fix for 24-bit MULTI_MASK 2020-11-03 11:47:53 -08:00
20172-external-symbols.dis65 Minor fix for 24-bit MULTI_MASK 2020-11-03 11:47:53 -08:00
20172-external-symbols.sym65 Minor fix for 24-bit MULTI_MASK 2020-11-03 11:47:53 -08:00
20180-extension-scripts-a.cs Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20180-extension-scripts-b.cs Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20180-extension-scripts.sym65 Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20182-extension-scripts Mark flags as indeterminate for inline BRK 2020-08-22 08:56:38 -07:00
20182-extension-scripts.dis65 Mark flags as indeterminate for inline BRK 2020-08-22 08:56:38 -07:00
20190-non-unique-labels Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20190-non-unique-labels.dis65 Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20200-ui-edge-cases Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20200-ui-edge-cases.dis65 Regression test rework, part 2 2020-06-06 15:36:08 -07:00
20212-reloc-data Update relocation data handling 2020-07-10 17:41:38 -07:00
20212-reloc-data.dis65 Add two options to OMF converter 2020-07-20 13:50:49 -07:00
20222-data-bank Data Bank Register management, part 6 (of 6) 2020-07-10 15:53:43 -07:00
20222-data-bank.dis65 Data Bank Register management, part 6 (of 6) 2020-07-10 15:53:43 -07:00
20233-rockwell Add W65C02S support, part 4 (of 4) 2020-10-11 18:43:00 -07:00
20233-rockwell.dis65 Add W65C02S support, part 4 (of 4) 2020-10-11 18:43:00 -07:00
20240-large-overlay Fix 64tass output for non-loadable files 2021-08-01 17:21:20 -07:00
20240-large-overlay.dis65 Fix 64tass output for non-loadable files 2021-08-01 17:21:20 -07:00
20250-nested-regions Implement IsRelative for cc65/merlin32 2021-10-09 10:08:14 -07:00
20250-nested-regions.dis65 Implement IsRelative for cc65/merlin32 2021-10-09 10:08:14 -07:00
20252-nested-regions ORG rework, part 7 2021-10-02 15:43:41 -07:00
20252-nested-regions.dis65 ORG rework, part 7 2021-10-02 15:43:41 -07:00
20260-pre-labels ORG rework, part 9 2021-10-07 12:39:30 -07:00
20260-pre-labels.dis65 ORG rework, part 9 2021-10-07 12:39:30 -07:00
20270-std-inline Ignore project/platform symbols in StdInline 2021-10-27 20:23:34 -07:00
20270-std-inline.dis65 Ignore project/platform symbols in StdInline 2021-10-27 20:23:34 -07:00
20280-label-placement Add option to put labels on separate lines 2024-04-21 16:26:42 -07:00
20280-label-placement.dis65 Add option to put labels on separate lines 2024-04-21 16:26:42 -07:00
README.md Add option to put labels on separate lines 2024-04-21 16:26:42 -07:00

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.56.2625
  • ACME v0.97
  • cc65 v2.18
  • Merlin 32 v1.0

Generator/Assembler Tests

Files with names like "10000-nifty-test" are regression test data files for the code generator. The test harness identifies them by filename pattern: five digits, a hyphen, then one or more alphanumeric and hyphens. Files with a '.' or '_' are ignored.

If the leading number is between 10000 and 19999, inclusive, the test file will be loaded as a new project. A load address of $1000 is assumed. The CPU type is determined by the last digit: 0 for 6502, 1 for 65C02, 2 for 65816, and 3 for W65C02. Undocumented opcodes are enabled. As with all new projects, the first byte will be tagged as a code start point. The entry flags are currently set to emulation mode, but tests should not rely on that.

If the leading number is 20000 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.

Overriding Settings

All tests are run with a fixed set of app settings, so that the tests look the same regardless of how the assemblers are configured in the app settings file. For example, upper-case conversion is disabled, and cycle counts are not shown.

Sometimes a test will want to exercise one of these settings, so we need a way to tell the test harness to override the default. We do this by creating project symbols:

Name Value Description
__ENABLE_LABEL_NEWLINE any Puts long labels on their own line
__ENABLE_ALL_LABEL_NEWLINE any Puts all labels on their own line
__ENABLE_CYCLE_COUNTS any Adds cycle count to end-of-line comments

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 10000-allops-value-6502 will have all of its generated output in a directory called "tmp10000". 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, a 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:

  1. Make the changes to the test data file and test project file.
  2. Run the test harness. The generation test will fail and leave output in the tmpNNNNN directory. Make sure the assembly test is succeeding.
  3. After verifying that the generated sources look correct, copy them into the Expected directory, replacing any existing copies.
  4. Run the test harness. This should now report success, and will remove the tmpNNNNN 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.