commit 396bf8385106080140cd3a0a262688a10fb65ea3
parent 254811f0ed3864e0913addb195eeb3f3b99de62d
Author: Jared Tobin <jared@jtobin.io>
Date: Mon, 16 Dec 2024 15:12:56 -0330
test: skeleton
Diffstat:
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/lib/Bitcoin/Prim/Script.hs b/lib/Bitcoin/Prim/Script.hs
@@ -57,10 +57,8 @@ to_base16 (Script bs) = toStrict (go 0) where
| j == l = mempty
| otherwise =
let b = PB.indexByteArray bs j :: Word8
-
!w4_hi = look (b `B.shiftR` 4)
!w4_lo = look (b .&. 0b00001111)
-
in BSB.word8 w4_hi <> BSB.word8 w4_lo <> go (succ j)
-- adapted from emilypi's 'base16' package
diff --git a/ppad-btcprim.cabal b/ppad-btcprim.cabal
@@ -31,3 +31,20 @@ library
, ppad-sha256
, ppad-ripemd160
, ppad-bech32
+
+test-suite btcprim-tests
+ type: exitcode-stdio-1.0
+ default-language: Haskell2010
+ hs-source-dirs: test
+ main-is: Main.hs
+
+ ghc-options:
+ -rtsopts -Wall
+
+ build-depends:
+ , base
+ , bytestring
+ , ppad-btcprim
+ , tasty
+ , tasty-hunit
+
diff --git a/test/Main.hs b/test/Main.hs
@@ -0,0 +1,8 @@
+module Main where
+
+import qualified Bitcoin.Prim.Script as Script
+import Test.Tasty
+import Test.Tasty.HUnit
+
+main :: IO ()
+main = pure ()