A2AUDIT tests

This commit is contained in:
Iván Izaguirre 2024-01-06 23:40:54 +01:00
parent c24eeef200
commit b1a643f748
2 changed files with 98 additions and 0 deletions

98
a2audit_test.go Normal file
View File

@ -0,0 +1,98 @@
package izapple2
import (
"strings"
"testing"
)
func testA2AuditInternal(t *testing.T, model string, removeLangCard bool, cycles uint64, messages []string) {
overrides := newConfiguration()
if removeLangCard {
overrides.set(confS0, "empty")
}
overrides.set(confS1, "empty")
overrides.set(confS2, "empty")
overrides.set(confS3, "empty")
overrides.set(confS4, "empty")
overrides.set(confS5, "empty")
overrides.set(confS6, "diskii,disk1=\"<internal>/audit.dsk\"")
overrides.set(confS7, "empty")
at, err := makeApple2Tester(model, overrides)
if err != nil {
t.Fatal(err)
}
at.terminateCondition = func(a *Apple2) bool {
return a.cpu.GetCycles() > cycles
}
at.run()
text := at.getText()
for _, message := range messages {
if !strings.Contains(text, message) {
t.Errorf("Expected '%s', got '%s'", message, text)
}
}
}
func TestA2Audit(t *testing.T) {
t.Run("test a2audit on Apple IIe enhanced", func(t *testing.T) {
testA2AuditInternal(t, "2enh", false, 4_000_000, []string{
"MEMORY:128K",
"APPLE IIE (ENHANCED)",
"LANGUAGE CARD TESTS SUCCEEDED",
"AUXMEM TESTS SUCCEEDED",
"SOFTSWITCH TESTS SUCCEEDED",
})
})
t.Run("test a2audit on Apple IIe", func(t *testing.T) {
testA2AuditInternal(t, "2e", false, 4_000_000, []string{
"MEMORY:128K",
"APPLE IIE",
"LANGUAGE CARD TESTS SUCCEEDED",
"AUXMEM TESTS SUCCEEDED",
"SOFTSWITCH TESTS SUCCEEDED",
})
})
t.Run("test a2audit on Apple II plus", func(t *testing.T) {
testA2AuditInternal(t, "2plus", false, 4_000_000, []string{
"MEMORY:64K",
"APPLE II PLUS",
"LANGUAGE CARD TESTS SUCCEEDED",
"64K OR LESS:SKIPPING AUXMEM TEST",
"NOT IIE OR IIC:SKIPPING SOFTSWITCH TEST",
})
})
t.Run("test a2audit on Apple II plus without lang card", func(t *testing.T) {
testA2AuditInternal(t, "2plus", true, 4_000_000, []string{
"MEMORY:48K",
"APPLE II PLUS",
"48K:SKIPPING LANGUAGE CARD TEST",
"64K OR LESS:SKIPPING AUXMEM TEST",
"NOT IIE OR IIC:SKIPPING SOFTSWITCH TEST",
})
})
/*
t.Run("test Mouse card", func(t *testing.T) {
testCardDetectedInternal(t, "2enh", "mouse", 50_000_000, "2 38-18-01-20 Apple II Mouse Card")
})
t.Run("test Parallel printer card", func(t *testing.T) {
testCardDetectedInternal(t, "2enh", "parallel", 50_000_000, "2 48-48-58-FF Apple Parallel Interface Card")
})
// Saturn not detected
// VidHD not detected
// Swyftcard not compatible with Card Cat
// Pending to try Saturn, 80col with 2plus.
t.Run("test ThunderClock Plus card", func(t *testing.T) {
testCardDetectedInternal(t, "2enh", "thunderclock", 50_000_000, "2 FF-05-18-B8 ThunderClock Plus Card")
})
*/
}

BIN
resources/audit.dsk Normal file

Binary file not shown.