Pudu programming language
Menu
Package

@chrismichaelps / pudu-lang-mediator

In-process messaging for Pudu: requests, notifications, streams, pipeline behaviors, processors, and exception handling

0.1.0Apache-2.01

InstallClose

OrderTest.pudu

Pudu36 lines1.6 KB

GitHub ↗
1/** @Test.Domain.Order.Suite — registration order of open and own components */2module PuduLangMediator.Domain.OrderTest34import Std.Io as Io5import Std.Test as Test6import PuduLangMediator.Domain.Order as Order78/// Runs the suite.9fn main() -> Int {10  let marks = [11    Order.Open(Order.Behaviors, 0),12    Order.Closed(Order.Behaviors, "a"),13    Order.Closed(Order.PreProcessors, "a"),14    Order.Closed(Order.Behaviors, "b"),15    Order.Open(Order.Behaviors, 1),16    Order.Closed(Order.Behaviors, "a"),17    Order.Open(Order.PreProcessors, 0),18    Order.Closed(Order.Behaviors, "a")19  ]20  let checks = Test.suite("Domain.Order", &[21      Test.equals("open and own behaviors interleave in registration order", &Order.picks(&marks, Order.Behaviors, "a"), &[22          Order.Shared(0), Order.Own(0), Order.Shared(1), Order.Own(1), Order.Own(2)23        ]),24      Test.equals("another kind's own components are skipped", &Order.picks(&marks, Order.Behaviors, "b"), &[Order.Shared(0), Order.Own(0), Order.Shared(1)]),25      Test.equals("each layer is ordered on its own", &Order.picks(&marks, Order.PreProcessors, "a"), &[Order.Own(0), Order.Shared(0)]),26      Test.equals("a kind with nothing of its own gets only the open ones", &Order.picks(&marks, Order.Behaviors, "c"), &[Order.Shared(0), Order.Shared(1)]),27      Test.equals("a layer with no marks picks nothing", &Order.picks(&marks, Order.StreamBehaviors, "a"), &[]),28      Test.equals("no marks pick nothing", &Order.picks(&[], Order.Behaviors, "a"), &[])29    ])30  let ran = Test.run(&checks)31  for failure in Test.failuresOf(&ran) {32    let _reported = Io.writeErrorLine(failure)33  }34  Test.report(&ran)35}36