Skip to content

Commit

Permalink
[mmzk] (feat) More tests on parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
MMZK1526 committed Apr 20, 2024
1 parent 7264551 commit c61d827
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ v7Test = do
case string2ID @TypeID "mmzk_00041061050r3gg28a1c60t3gf" of
Left err -> expectationFailure $ "Parse error: " ++ show err
Right tid -> getPrefix tid `shouldBe` "mmzk"
it "can parse TypeID from Text" do
case text2ID @TypeID "mmzk_00041061050r3gg28a1c60t3gf" of
Left err -> expectationFailure $ "Parse error: " ++ show err
Right tid -> getPrefix tid `shouldBe` "mmzk"
it "can parse TypeID from ByteString" do
case byteString2ID @TypeID "mmzk_00041061050r3gg28a1c60t3gf" of
Left err -> expectationFailure $ "Parse error: " ++ show err
Right tid -> getPrefix tid `shouldBe` "mmzk"

describe "Parse TypeID" do
let invalidPrefixes = [ ("caps", "PREFIX")
Expand Down Expand Up @@ -321,6 +329,14 @@ v1Test = do
case string2ID @TypeIDV1 "mmzk_5hjpeh96458fct8t49fnf9farw" of
Left err -> expectationFailure $ "Parse error: " ++ show err
Right tid -> getPrefix tid `shouldBe` "mmzk"
it "can parse TypeIDV1 from Text" do
case text2ID @TypeID "mmzk_00041061050r3gg28a1c60t3gf" of
Left err -> expectationFailure $ "Parse error: " ++ show err
Right tid -> getPrefix tid `shouldBe` "mmzk"
it "can parse TypeIDV1 from ByteString" do
case byteString2ID @TypeID "mmzk_00041061050r3gg28a1c60t3gf" of
Left err -> expectationFailure $ "Parse error: " ++ show err
Right tid -> getPrefix tid `shouldBe` "mmzk"

describe "Parse TypeIDV1" do
let invalidPrefixes = [ ("caps", "PREFIX")
Expand Down Expand Up @@ -502,6 +518,14 @@ v4Test = do
case string2ID @TypeIDV4 "mmzk_5hjpeh96458fct8t49fnf9farw" of
Left err -> expectationFailure $ "Parse error: " ++ show err
Right tid -> getPrefix tid `shouldBe` "mmzk"
it "can parse TypeIDV4 from Text" do
case text2ID @TypeID "mmzk_00041061050r3gg28a1c60t3gf" of
Left err -> expectationFailure $ "Parse error: " ++ show err
Right tid -> getPrefix tid `shouldBe` "mmzk"
it "can parse TypeIDV4 from ByteString" do
case byteString2ID @TypeID "mmzk_00041061050r3gg28a1c60t3gf" of
Left err -> expectationFailure $ "Parse error: " ++ show err
Right tid -> getPrefix tid `shouldBe` "mmzk"

describe "Parse TypeIDV4" do
let invalidPrefixes = [ ("caps", "PREFIX")
Expand Down Expand Up @@ -685,6 +709,14 @@ v5Test = do
case string2ID @TypeIDV5 "mmzk_5hjpeh96458fct8t49fnf9farw" of
Left err -> expectationFailure $ "Parse error: " ++ show err
Right tid -> getPrefix tid `shouldBe` "mmzk"
it "can parse TypeIDV5 from Text" do
case text2ID @TypeID "mmzk_00041061050r3gg28a1c60t3gf" of
Left err -> expectationFailure $ "Parse error: " ++ show err
Right tid -> getPrefix tid `shouldBe` "mmzk"
it "can parse TypeIDV5 from ByteString" do
case byteString2ID @TypeID "mmzk_00041061050r3gg28a1c60t3gf" of
Left err -> expectationFailure $ "Parse error: " ++ show err
Right tid -> getPrefix tid `shouldBe` "mmzk"

describe "Parse TypeIDV5" do
uid <- runIO nextRandom
Expand Down

0 comments on commit c61d827

Please sign in to comment.