From d71a77ab7227937ae8190d0b745b94056330af29 Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Thu, 2 May 2024 18:13:19 -0400 Subject: fig-emulator-gb: CPU passes all tests! --- fig-emulator-gb/main/Main.hs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'fig-emulator-gb/main') 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 ] -- cgit v1.2.3