Browse Source

Document and add new ASM tests.

master
Ben Kurtovic 8 years ago
parent
commit
c632ddf9bd
11 changed files with 102 additions and 1 deletions
  1. +8
    -0
      tests/asm/02-headers1.asm
  2. +8
    -0
      tests/asm/03-headers2.asm
  3. +8
    -0
      tests/asm/04-basic.asm
  4. +9
    -0
      tests/asm/05-includes.asm
  5. +15
    -0
      tests/asm/06-formatting.asm
  6. +13
    -0
      tests/asm/06.inc.asm
  7. +31
    -0
      tests/asm/07-data.asm
  8. +7
    -0
      tests/asm/08-instructions.asm
  9. +2
    -0
      tests/asm/manifest
  10. BIN
     
  11. +1
    -1
      tests/runner.c

+ 8
- 0
tests/asm/02-headers1.asm View File

@@ -1,3 +1,11 @@
;; Copyright (C) 2016 Ben Kurtovic <ben.kurtovic@gmail.com>
;; Released under the terms of the MIT License. See LICENSE for details.

; ----- CRATER UNIT TESTING SUITE ---------------------------------------------

; 02-headers1.asm
; Basic test for headers and other directives, mostly using default values

.rom_size auto .rom_size auto
.rom_header auto .rom_header auto
.rom_product 0 .rom_product 0


+ 8
- 0
tests/asm/03-headers2.asm View File

@@ -1,3 +1,11 @@
;; Copyright (C) 2016 Ben Kurtovic <ben.kurtovic@gmail.com>
;; Released under the terms of the MIT License. See LICENSE for details.

; ----- CRATER UNIT TESTING SUITE ---------------------------------------------

; 03-headers2.asm
; Header/directive test using non-default values

.rom_size "64 KB" .rom_size "64 KB"
.rom_header $7FF0 .rom_header $7FF0
.rom_product 101893 .rom_product 101893


+ 8
- 0
tests/asm/04-basic.asm View File

@@ -1,3 +1,11 @@
;; Copyright (C) 2016 Ben Kurtovic <ben.kurtovic@gmail.com>
;; Released under the terms of the MIT License. See LICENSE for details.

; ----- CRATER UNIT TESTING SUITE ---------------------------------------------

; 04-basic.asm
; Basic instruction test

.org $0000 .org $0000
main: main:
di di


+ 9
- 0
tests/asm/05-includes.asm View File

@@ -1,3 +1,12 @@
;; Copyright (C) 2016 Ben Kurtovic <ben.kurtovic@gmail.com>
;; Released under the terms of the MIT License. See LICENSE for details.

; ----- CRATER UNIT TESTING SUITE ---------------------------------------------

; 05-includes.asm
; Source file inclusion test, involving cross-file label references and complex
; origins

.include "05.inc1.asm" .include "05.inc1.asm"


.org $0000 .org $0000


+ 15
- 0
tests/asm/06-formatting.asm View File

@@ -0,0 +1,15 @@
;; Copyright (C) 2016 Ben Kurtovic <ben.kurtovic@gmail.com>
;; Released under the terms of the MIT License. See LICENSE for details.

; ----- CRATER UNIT TESTING SUITE ---------------------------------------------

; 06-formatting.asm
; Complex formatting test, involving strange indentation and newline usage

foo: .inCLUde "06.inc.asm"

.ORG $0100

ayy: lmao:
di
ret

+ 13
- 0
tests/asm/06.inc.asm View File

@@ -0,0 +1,13 @@
test1:test2: test3: test4:



inc a

inc b
inc c

ret




+ 31
- 0
tests/asm/07-data.asm View File

@@ -0,0 +1,31 @@
;; Copyright (C) 2016 Ben Kurtovic <ben.kurtovic@gmail.com>
;; Released under the terms of the MIT License. See LICENSE for details.

; ----- CRATER UNIT TESTING SUITE ---------------------------------------------

; 07-data.asm
; Test of data directives to fill ROM with non-code bytes

.org $1000

str1: .ascii "Hello, world!"
str2: .asciz "World, hello!"
str3: .asciiz "foobar"

arr1: .byte 1 2 3 4 5 6
arr2: .byte 14 $14 $FF 255 $F0
arr3: .byte 8, $10, 4 5 6, 8, 10

void1: .space 3
void2: .space 6 $D0
void3: .space 128 $DE

.org $0000
main:
di
loop:
jp loop

.org $0066
nmi:
retn

+ 7
- 0
tests/asm/08-instructions.asm View File

@@ -0,0 +1,7 @@
;; Copyright (C) 2016 Ben Kurtovic <ben.kurtovic@gmail.com>
;; Released under the terms of the MIT License. See LICENSE for details.

; ----- CRATER UNIT TESTING SUITE ---------------------------------------------

; 08-instructions.asm
; Exhaustive test of instruction syntax

+ 2
- 0
tests/asm/manifest View File

@@ -3,3 +3,5 @@
03-headers2.asm 03-headers2.gg 03-headers2.asm 03-headers2.gg
04-basic.asm 04-basic.gg 04-basic.asm 04-basic.gg
05-includes.asm 05-includes.gg 05-includes.asm 05-includes.gg
06-formatting.asm 06-formatting.gg
07-data.asm 07-data.gg

BIN
View File


+ 1
- 1
tests/runner.c View File

@@ -206,7 +206,7 @@ static bool test_asm()


*(split++) = '\0'; *(split++) = '\0';
if (!run_asm_test(line, split)) { if (!run_asm_test(line, split)) {
fprintf(stderr, "test: %s -> %s\n", line, split);
fprintf(stderr, "in test: %s -> %s\n", line, split);
return false; return false;
} }
PASS_TEST() PASS_TEST()


Loading…
Cancel
Save