ref: bfea4e5ee9483831dc316f728acc702b39c593ea
parent: e70f7204c86edc3742f6329169bb926552158915
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Sun Dec 17 15:54:54 EST 2023
Start by printing system info.
--- /dev/null
+++ b/tests/Info.hs
@@ -1,0 +1,23 @@
+module Info(main) where
+import Prelude
+import Foreign.Storable
+import Foreign.Marshal.Utils
+import Foreign.Ptr
+import Data.Word
+import Data.Word8
+
+main :: IO ()
+main = do
+ putStrLn $ "Running on " ++ if _isWindows then "Windows" else "Unix"
+ putStr $ show _wordSize ++ " bit words, "
+
+ let
+ w :: Word
+ w = if _wordSize == 32 then 0x01000002 else 0x0100000000000002
+ p <- new w
+ b <- peek (castPtr p :: Ptr Word8)
+ putStrLn $
+ case b of
+ 1 -> "big endian"
+ 2 -> "little endian"
+ _ -> "Mystery Endian"
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,13 +1,16 @@
MHS=../bin/gmhs
TMHS=$(MHS) -i../lib
EVAL=../bin/mhseval +RTS -H1M -RTS
-.PHONY: test nfib clean errtest alltest cache
+.PHONY: test nfib clean errtest alltest cache info
-alltest: test errtest
+alltest: info test errtest
cache:
rm -f .mhscache
$(TMHS) -c AllOfLib
+
+info:
+ $(TMHS) Info && $(EVAL)
test:
$(TMHS) Hello && $(EVAL) > Hello.out && diff Hello.ref Hello.out
--
⑨