summaryrefslogtreecommitdiff
path: root/haskell
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2018-10-28 20:26:11 -0400
committerJoe Crayne <joe@jerkface.net>2018-10-28 20:26:11 -0400
commite9b600cb1b1376078082a1f2511b720d1508f579 (patch)
tree7dc84c850d45f13e4aba2a2b7430325c33d93f54 /haskell
parentb344e040b82cfbdb8b82bebd397f18661d7f88c7 (diff)
Buggy test program.
Diffstat (limited to 'haskell')
-rw-r--r--haskell/examples/bug.hs56
1 files changed, 56 insertions, 0 deletions
diff --git a/haskell/examples/bug.hs b/haskell/examples/bug.hs
new file mode 100644
index 0000000..c09adbe
--- /dev/null
+++ b/haskell/examples/bug.hs
@@ -0,0 +1,56 @@
1{-# LANGUAGE OverloadedStrings #-}
2
3import qualified Data.ByteString.Lazy as L
4import Data.VCDIFF
5import Text.XXD
6
7source :: L.ByteString
8source = "It could be said that Joe was here. I don't know what to do about it."
9
10target :: L.ByteString
11target = "It could be said that Joe, the magnificent, was here. I don't know what to do about it."
12
13source2 :: L.ByteString
14source2 = "It could be said that Joe was absolutely here. I don't know what to do about it."
15
16delta :: Result VCDIFF
17delta = computeDiff defaultConfig { flags = XD3_ADLER32 } source target
18
19delta2 :: Result VCDIFF
20delta2 = computeDiff defaultConfig { flags = XD3_ADLER32 } source target
21
22main = do
23 putStrLn "source"
24 mapM_ putStrLn $ xxd2 0 (L.toStrict source)
25 putStrLn ""
26 putStrLn "target"
27 mapM_ putStrLn $ xxd2 0 (L.toStrict target)
28 putStrLn ""
29 case delta of
30 Result δ me -> do
31 let d = encodeVCDIFF δ
32 putStrLn "diff(default)"
33 mapM_ putStrLn $ xxd2 0 (L.toStrict d)
34 print me
35 {-
36 putStrLn ""
37 putStrLn "patched(default)"
38 let Result patched pe = applyPatch defaultConfig source2 δ
39 mapM_ putStrLn $ xxd2 0 (L.toStrict patched) -- $ L.take 48 target')
40 print pe
41 -}
42 return ()
43 putStrLn $ "source = " ++ show source
44 putStrLn $ "target = " ++ show target
45 putStrLn ""
46 case delta2 of
47 Result δ me -> do
48 let d = encodeVCDIFF δ
49 putStrLn "diff(XD3_ADLER32)"
50 mapM_ putStrLn $ xxd2 0 (L.toStrict d)
51 print me
52 putStrLn ""
53 let Result patched pe = applyPatch defaultConfig source2 δ
54 putStrLn "patched(XD3_ADLER32)"
55 mapM_ putStrLn $ xxd2 0 (L.toStrict patched) -- $ L.take 48 target')
56 print pe