summaryrefslogtreecommitdiff
path: root/fig-emulator-gb/main
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2024-05-02 18:13:19 -0400
committerLLLL Colonq <llll@colonq>2024-05-02 18:13:19 -0400
commitd71a77ab7227937ae8190d0b745b94056330af29 (patch)
tree7ed2d7bae9b1b2d39b5158b579661b789e1b04f3 /fig-emulator-gb/main
parent64624b52279bd76d473aa92b072a0e5ebd516530 (diff)
fig-emulator-gb: CPU passes all tests!
Diffstat (limited to 'fig-emulator-gb/main')
-rw-r--r--fig-emulator-gb/main/Main.hs16
1 files changed, 12 insertions, 4 deletions
diff --git a/fig-emulator-gb/main/Main.hs b/fig-emulator-gb/main/Main.hs
index 8cb61d0..7a15c45 100644
--- a/fig-emulator-gb/main/Main.hs
+++ b/fig-emulator-gb/main/Main.hs
@@ -4,8 +4,12 @@ module Main where
import Fig.Prelude
+import qualified System.Directory as Dir
+
import Options.Applicative
+import Control.Monad (unless)
+
import Control.Exception.Safe (Handler(..), catches)
import qualified Data.ByteString as BS
@@ -34,8 +38,8 @@ parseInstrTestOptions = do
pure InstrTestOptions{..}
data Command
- = CommandRun RunOptions
- | CommandInstrTest InstrTestOptions
+ = CommandRun !RunOptions
+ | CommandInstrTest !InstrTestOptions
deriving Show
parseOptions :: Parser Command
@@ -56,8 +60,12 @@ main = do
testRun (serialOut opts) rom
CommandInstrTest opts -> catches
( do
- tcs <- readTestcases $ testcasesPath opts
- forM_ tcs runTestcase
+ paths <- Dir.listDirectory $ testcasesPath opts
+ forM_ paths \p -> do
+ unless (p == "README.md") do
+ hPutStrLn stderr $ "Running test file: " <> pack p <> "..."
+ tcs <- readTestcases $ testcasesPath opts <> "/" <> p
+ forM_ tcs runTestcase
)
[ Handler \(e :: InstrTestError) -> liftIO . hPutStrLn stderr $ pretty e
]