mirror of
https://github.com/urbit/shrub.git
synced 2024-11-28 05:22:27 +03:00
Updated tests to new Ames events.
This commit is contained in:
parent
c5b0834bca
commit
dbe174d522
@ -33,7 +33,7 @@ turfEf :: NewtEf
|
||||
turfEf = NewtEfTurf (0, ()) []
|
||||
|
||||
sendEf :: Galaxy -> Wen -> Bytes -> NewtEf
|
||||
sendEf g w bs = NewtEfSend (0, ()) (ADGala w g) bs
|
||||
sendEf g w bs = NewtEfSend (0, ()) (EachYes g) bs
|
||||
|
||||
data NetworkTestApp = NetworkTestApp
|
||||
{ _ntaLogFunc :: !LogFunc
|
||||
@ -74,9 +74,9 @@ waitForPacket q val = go
|
||||
where
|
||||
go =
|
||||
atomically (readTQueue q) >>= \case
|
||||
EvBlip (BlipEvAmes (AmesEvWake () ())) -> go
|
||||
EvBlip (BlipEvAmes (AmesEvHear () _ bs)) -> pure (bs == val)
|
||||
_ -> pure False
|
||||
EvBlip (BlipEvNewt (NewtEvBorn (_, ()) ())) -> go
|
||||
EvBlip (BlipEvAmes (AmesEvHear () _ bs)) -> pure (bs == val)
|
||||
_ -> pure False
|
||||
|
||||
runRAcquire :: RAcquire e a -> RIO e a
|
||||
runRAcquire acq = rwith acq pure
|
||||
@ -170,10 +170,16 @@ instance Arbitrary BigCord where
|
||||
arbitrary = BigCord <$> arb
|
||||
|
||||
instance Arbitrary AmesDest where
|
||||
arbitrary = oneof [ ADGala <$> arb <*> arb
|
||||
, ADIpv4 <$> arb <*> arb <*> genIpv4
|
||||
arbitrary = oneof [ EachYes <$> arb
|
||||
, EachNo <$> arb
|
||||
]
|
||||
|
||||
instance Arbitrary a => Arbitrary (Jammed a) where
|
||||
arbitrary = Jammed <$> arbitrary
|
||||
|
||||
instance Arbitrary AmesAddress where
|
||||
arbitrary = AAIpv4 <$> arb <*> arb
|
||||
|
||||
instance Arbitrary Ship where
|
||||
arbitrary = Ship <$> arb
|
||||
|
||||
|
@ -39,9 +39,7 @@ eventSanity = all $ \(EvEx e n) -> toNoun e == n
|
||||
|
||||
instance Arbitrary EvExample where
|
||||
arbitrary = oneof $ fmap pure $
|
||||
[ EvEx (EvBlip $ BlipEvAmes $ AmesEvWant (Path []) (Ship 0) (Path []) (A 0))
|
||||
(toNoun (Path ["", "ames"], (Cord "want", (), (), ())))
|
||||
, EvEx (EvVane $ VaneVane $ VEVeer (Jael, ()) "" (Path []) "")
|
||||
[ EvEx (EvVane $ VaneVane $ VEVeer (Jael, ()) "" (Path []) "")
|
||||
(toNoun (Path ["vane", "vane", "jael"], Cord "veer", (), (), ()))
|
||||
]
|
||||
|
||||
@ -99,19 +97,19 @@ genIpv4 = do
|
||||
then genIpv4
|
||||
else pure (Ipv4 x)
|
||||
|
||||
instance Arbitrary AmesDest where
|
||||
arbitrary = oneof [ ADGala <$> arb <*> arb
|
||||
, ADIpv4 <$> arb <*> arb <*> genIpv4
|
||||
]
|
||||
instance (Arbitrary a, Arbitrary b) => Arbitrary (Each a b) where
|
||||
arbitrary = oneof [ EachNo <$> arb, EachYes <$> arb ]
|
||||
|
||||
instance (Arbitrary a) => Arbitrary (Jammed a) where
|
||||
arbitrary = Jammed <$> arbitrary
|
||||
|
||||
instance Arbitrary Ef where
|
||||
arbitrary = oneof [ EfVega <$> arb <*> arb
|
||||
]
|
||||
|
||||
instance Arbitrary AmesEv where
|
||||
arbitrary = oneof [ AmesEvHear () <$> arb <*> arb
|
||||
, AmesEvWake <$> pure () <*> pure ()
|
||||
, AmesEvWant <$> arb <*> arb <*> arb <*> arb
|
||||
arbitrary = oneof [ AmesEvHear () <$> arb <*> arb
|
||||
, AmesEvHole () <$> arb <*> arb
|
||||
]
|
||||
|
||||
instance Arbitrary HttpRequest where
|
||||
@ -164,6 +162,10 @@ instance Arbitrary ServId where arbitrary = ServId <$> arb
|
||||
instance Arbitrary UD where arbitrary = UD <$> arb
|
||||
instance Arbitrary UV where arbitrary = UV <$> arb
|
||||
|
||||
instance Arbitrary AmesAddress where
|
||||
arbitrary = AAIpv4 <$> arb <*> arb
|
||||
|
||||
instance Arbitrary Ipv4 where arbitrary = Ipv4 <$> arb
|
||||
|
||||
-- Generate Arbitrary Values ---------------------------------------------------
|
||||
|
||||
|
@ -1,2 +1,6 @@
|
||||
module Main where
|
||||
|
||||
import ClassyPrelude
|
||||
|
||||
main :: IO ()
|
||||
main = putStrLn "Test suite not yet implemented"
|
||||
|
Loading…
Reference in New Issue
Block a user