Compare output of compress2 by hashing
authorSebastian Graf <sgraf1337@gmail.com>
Mon, 31 Dec 2018 10:00:41 +0000 (11:00 +0100)
committerSebastian Graf <sgraf1337@gmail.com>
Tue, 1 Jan 2019 17:13:47 +0000 (18:13 +0100)
This should fix the build in the same way as !2.

.gitignore
real/compress2/Main.hs
real/compress2/Makefile
real/compress2/compress2.faststdout
real/compress2/compress2.stdout [new file with mode: 0644]

index f1fae44..6730d53 100644 (file)
@@ -36,7 +36,6 @@ real/compress/compress
 real/compress/compress.stdin
 real/compress2/compress2
 real/compress2/compress2.stdin
-real/compress2/compress2.stdout
 real/eff/CS/CS
 real/eff/CSD/CSD
 real/eff/FS/FS
index 3562644..592c00a 100644 (file)
@@ -8,12 +8,16 @@ where
 import Encode
 import WriteRoutines
 import System.IO
+import Data.Char
+import Data.List (foldl')
+
+hash :: String -> Int
+hash = foldl' (\acc c -> ord c + acc*31) 0
 
 main = do
   hSetBinaryMode stdin  True
-  hSetBinaryMode stdout True
   i <- getContents
-  putStr (compress i)
+  print (hash (compress i))
 
 -- The output is given by a magic header consisting of two fixed numbers,
 -- and a third representing the maximum number of bits used per code and
index 7a605f6..3a81e95 100644 (file)
@@ -1,23 +1,17 @@
 TOP = ../..
 include $(TOP)/mk/boilerplate.mk
 
-SRC_RUNTEST_OPTS += -stdout-binary
-
 SRC_HC_OPTS += -fglasgow-exts
 
 SRC_RUNTEST_OPTS += +RTS -H100m -RTS
 
+CLEAN_FILES += compress2.stdin
+
 include $(TOP)/mk/target.mk
 
-boot :: compress2.stdin compress2.faststdin compress2.stdout
+boot :: compress2.stdin
 
 CAT_FILES = compress2.faststdin *.hs compress2.faststdin *.hs
 
 compress2.stdin : compress2.faststdin
        cat $(CAT_FILES) $(CAT_FILES) $(CAT_FILES) $(CAT_FILES) $(CAT_FILES) > compress2.stdin
-
-compress2.stdout : compress2.stdin compress2
-       ./compress2 < compress2.stdin > compress2.stdout
-
-clean ::
-       rm -f compress2.stdin compress2.stdout
index d5c2f00..1d09915 100644 (file)
Binary files a/real/compress2/compress2.faststdout and b/real/compress2/compress2.faststdout differ
diff --git a/real/compress2/compress2.stdout b/real/compress2/compress2.stdout
new file mode 100644 (file)
index 0000000..5c949b3
--- /dev/null
@@ -0,0 +1 @@
+8522868473445645791