packages feed

xch 0.1.0.0 → 0.1.0.1

raw patch · 4 files changed

+126/−3 lines, 4 filesdep +bytestringdep +filepathdep +tasty-golden

Dependencies added: bytestring, filepath, tasty-golden

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for xch +## 0.1.0.1 -- 11-14-2026++* Add golden sample test+ ## 0.1.0.0 -- 11-13-2026  * First version. Released on an unsuspecting world.
+ data/sample.golden view
@@ -0,0 +1,90 @@+<xch>+  <svdat>+    <state>foo</state>+    <time>1970-01-01T00:00:34.5Z</time>+    <pos>+      <ned>+        <north>0.0</north>+        <east>1.0</east>+        <down>2.0</down>+      </ned>+    </pos>+    <vel>+      <ned>+        <north>0.3</north>+        <east>0.4</east>+        <down>0.5</down>+      </ned>+    </vel>+  </svdat>+  <svdat>+    <state>bar</state>+    <time>1970-01-01T00:00:02.2Z</time>+    <pos>+      <ned>+        <north>0.5</north>+        <east>0.6</east>+        <down>0.7</down>+      </ned>+    </pos>+  </svdat>+  <misn>+    <trig>at noon</trig>+    <evt>lunch</evt>+    <evt>hot dog</evt>+    <evt>wine</evt>+  </misn>+  <misn>+    <trig>at 6PM</trig>+    <evt>dinner</evt>+    <evt>spaghetti</evt>+    <evt>boba</evt>+  </misn>+  <com>+    <good/>+  </com>+  <aedat>+    <ae>anomaly</ae>+    <actdur>+      <act>4</act>+      <dur>5</dur>+    </actdur>+    <loc>+      <geo>area 61</geo>+      <lat>+        <cord>+          <dgs>0</dgs>+          <mns>1</mns>+          <sds>2.0</sds>+        </cord>+      </lat>+      <lon>+        <cord>+          <dgs>3</dgs>+          <mns>4</mns>+          <sds>5.9</sds>+        </cord>+      </lon>+      <lat>+        <cord>+          <dgs>5</dgs>+          <mns>6</mns>+          <sds>7.8</sds>+        </cord>+      </lat>+      <lon>+        <cord>+          <dgs>9</dgs>+          <mns>10</mns>+          <sds>11.1</sds>+        </cord>+      </lon>+      <alt>3.14</alt>+    </loc>+    <dfn>cactus</dfn>+  </aedat>+  <aedat>+    <ae>emergency</ae>+    <dfn>fashion</dfn>+  </aedat>+</xch>
test/Main.hs view
@@ -1,19 +1,38 @@ module Main (main) where +import qualified Data.ByteString.Lazy.Char8 as BS import Data.List import Data.Word import Data.Xch import Hedgehog import qualified Hedgehog.Gen as Gen import qualified Hedgehog.Range as Range+import Paths_xch+import System.FilePath import Text.Megaparsec import Test.Tasty+import Test.Tasty.Golden import Test.Tasty.HUnit import Test.Tasty.Hedgehog  main :: IO ()-main = defaultMain $ testGroup "Test.Xch"-  [testEmpty, testSVDat, testMsnEvt, testComStat, testAEDat, ptrip]+main = getDataDir >>= \dataDir ->+  defaultMain $ testGroup "Test.Xch"+  [ testEmpty, testSVDat, testMsnEvt, testComStat, testAEDat, ptrip+  , goldTest "sample" (dataDir </> "sample.golden")+    [ SVDat "foo" [Time 34.5, Pos $ NED 0 1 2, Vel $ NED 0.3 0.4 0.5]+    , SVDat "bar" [Time 2.2, Pos $ NED 0.5 0.6 0.7]+    , MsnEvt "at noon" ["lunch", "hot dog", "wine"]+    , MsnEvt "at 6PM"  ["dinner", "spaghetti", "boba"]+    , ComStat Good+    , AEDat "anomaly"+      [ ActDurTime 4 5+      , LocGeo "area 61" [(Cord 0 1 2, Cord 3 4 5.9), (Cord 5 6 7.8, Cord 9 10 11.1)] (Just 3.14)+      , Dfn "cactus"+      ]+    , AEDat "emergency" [Dfn "fashion"]+    ]+  ]  testEmpty :: TestTree testEmpty = testCase "empty" $ do@@ -139,3 +158,6 @@  rangeList :: Range Int rangeList = Range.linearFrom 0 0 64++goldTest :: String -> FilePath -> Xch -> TestTree+goldTest n p x = goldenVsString n p $ return $ BS.pack $ wxch x ++ "\n"
xch.cabal view
@@ -1,6 +1,6 @@ cabal-version:      3.0 name:               xch-version:            0.1.0.0+version:            0.1.0.1 synopsis:           Space Data Exchange description:        ASTM F3514-21 homepage:           https://github.com/dopamane/xch@@ -13,6 +13,8 @@ build-type:         Simple extra-doc-files:    CHANGELOG.md                     README.md+data-dir:           data+data-files:         sample.golden  source-repository head   type: git@@ -47,11 +49,16 @@   hs-source-dirs:   test   type:             exitcode-stdio-1.0   main-is:          Main.hs+  other-modules:    Paths_xch+  autogen-modules:  Paths_xch   build-depends:     base < 5,+    bytestring,+    filepath,     hedgehog,     megaparsec,     tasty,+    tasty-golden,     tasty-hedgehog,     tasty-hunit,     xch