Remove broken tests
This commit is contained in:
parent
0742665288
commit
a8e8eed619
|
@ -1,6 +1,6 @@
|
||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "20220829"
|
version = "20220830"
|
||||||
author = "Emery Hemingway"
|
author = "Emery Hemingway"
|
||||||
description = "Syndicated actors for conversational concurrency"
|
description = "Syndicated actors for conversational concurrency"
|
||||||
license = "Unlicense"
|
license = "Unlicense"
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
|
|
||||||
## Date of generation: 2021-09-01 13:32
|
|
||||||
import
|
|
||||||
std/typetraits, preserves
|
|
||||||
|
|
||||||
type
|
|
||||||
EmbeddedType = void
|
|
||||||
BoxState* {.record: "box-state".} = object ## ``<box-state @value int>``
|
|
||||||
`value`*: BiggestInt
|
|
||||||
|
|
||||||
SetBox* {.record: "set-box".} = object ## ``<set-box @value int>``
|
|
||||||
`value`*: BiggestInt
|
|
||||||
|
|
||||||
proc prsBoxState*(value: Preserve | BiggestInt): Preserve =
|
|
||||||
initRecord[EmbeddedType](symbol("box-state", EmbeddedType),
|
|
||||||
toPreserve(value, EmbeddedType))
|
|
||||||
|
|
||||||
proc prsSetBox*(value: Preserve | BiggestInt): Preserve =
|
|
||||||
initRecord[EmbeddedType](symbol("set-box", EmbeddedType),
|
|
||||||
toPreserve(value, EmbeddedType))
|
|
|
@ -1,66 +0,0 @@
|
||||||
# SPDX-FileCopyrightText: 2021 ☭ Emery Hemingway
|
|
||||||
# SPDX-License-Identifier: Unlicense
|
|
||||||
|
|
||||||
import syndicate/assertions, syndicate/dataspaces, syndicate/events, syndicate/skeletons
|
|
||||||
import preserves, preserves/records
|
|
||||||
import asyncdispatch, tables, options
|
|
||||||
|
|
||||||
import ./box_and_client
|
|
||||||
|
|
||||||
const N = 100000
|
|
||||||
|
|
||||||
let
|
|
||||||
`?_` = Discard().toPreserve
|
|
||||||
`?$` = Capture().toPreserve
|
|
||||||
|
|
||||||
proc boot(facet: Facet) =
|
|
||||||
|
|
||||||
facet.spawn("box") do (facet: Facet):
|
|
||||||
facet.declareField(value, int, 0)
|
|
||||||
|
|
||||||
facet.addEndpoint do (facet: Facet) -> EndpointSpec:
|
|
||||||
# echo "recomputing published BoxState ", facet.fields.value
|
|
||||||
result.assertion = prsBoxState(value.getPreserve)
|
|
||||||
|
|
||||||
facet.addDataflow do (facet: Facet):
|
|
||||||
# echo "box dataflow saw new value ", facet.fields.value
|
|
||||||
if value.get == N:
|
|
||||||
facet.stop do (facet: Facet):
|
|
||||||
echo "terminated box root facet"
|
|
||||||
|
|
||||||
facet.addEndpoint do (facet: Facet) -> EndpointSpec:
|
|
||||||
let a = prsSetBox(`?$`)
|
|
||||||
result.analysis = some analyzeAssertion(a)
|
|
||||||
proc cb(facet: Facet; vs: seq[Value]) =
|
|
||||||
facet.scheduleScript do (facet: Facet):
|
|
||||||
value.set(vs[0])
|
|
||||||
# echo "box updated value ", vs[0]
|
|
||||||
result.callback = facet.wrap(messageEvent, cb)
|
|
||||||
result.assertion = observe(prsSetBox(`?$`))
|
|
||||||
|
|
||||||
facet.spawn("client") do (facet: Facet):
|
|
||||||
|
|
||||||
facet.addEndpoint do (facet: Facet) -> EndpointSpec:
|
|
||||||
let a = prsBoxState(`?$`)
|
|
||||||
result.analysis = some analyzeAssertion(a)
|
|
||||||
proc cb(facet: Facet; vs: seq[Value]) =
|
|
||||||
facet.scheduleScript do (facet: Facet):
|
|
||||||
let v = prsSetBox(vs[0].int.succ.toPreserve)
|
|
||||||
# echo "client sending ", v
|
|
||||||
facet.send(v)
|
|
||||||
result.callback = facet.wrap(addedEvent, cb)
|
|
||||||
result.assertion = observe(prsBoxState(`?$`))
|
|
||||||
|
|
||||||
facet.addEndpoint do (facet: Facet) -> EndpointSpec:
|
|
||||||
let a = prsBoxState(`?_`)
|
|
||||||
result.analysis = some analyzeAssertion(a)
|
|
||||||
proc cb(facet: Facet; vs: seq[Value]) =
|
|
||||||
facet.scheduleScript do (facet: Facet):
|
|
||||||
echo "box gone"
|
|
||||||
result.callback = facet.wrap(removedEvent, cb)
|
|
||||||
result.assertion = observe(prsBoxState(`?_`))
|
|
||||||
|
|
||||||
facet.actor.dataspace.ground.addStopHandler do (_: Dataspace):
|
|
||||||
echo "stopping box-and-client"
|
|
||||||
|
|
||||||
waitFor bootModule("box-and-client", boot)
|
|
|
@ -1,35 +0,0 @@
|
||||||
# SPDX-FileCopyrightText: ☭ 2021 Emery Hemingway
|
|
||||||
# SPDX-License-Identifier: Unlicense
|
|
||||||
|
|
||||||
import std/asyncdispatch
|
|
||||||
import preserves
|
|
||||||
import syndicate
|
|
||||||
|
|
||||||
import ./box_and_client
|
|
||||||
|
|
||||||
syndicate testDsl:
|
|
||||||
|
|
||||||
spawn "box":
|
|
||||||
field(currentValue, BiggestInt, 0)
|
|
||||||
publish prsBoxState(currentValue.get)
|
|
||||||
stopIf currentValue.get == 10:
|
|
||||||
echo "box: terminating"
|
|
||||||
onMessage(prsSetBox(?newValue)) do (newValue: int):
|
|
||||||
# The SetBox message is unpacked to `newValue: int`
|
|
||||||
echo "box: taking on new value ", newValue
|
|
||||||
currentValue.set(newValue)
|
|
||||||
|
|
||||||
spawn "client":
|
|
||||||
#stopIf retracted(observe(SetBox, _)):
|
|
||||||
# echo "client: box has gone"
|
|
||||||
onAsserted(prsBoxState(?v)) do (v: BiggestInt):
|
|
||||||
echo "client: learned that box's value is now ", v
|
|
||||||
send(prsSetBox(v.succ))
|
|
||||||
onRetracted(prsBoxState(?_)) do (_):
|
|
||||||
echo "client: box state disappeared"
|
|
||||||
onStop:
|
|
||||||
quit(0) # Quit explicitly rather than let the dispatcher run empty.
|
|
||||||
|
|
||||||
runForever()
|
|
||||||
# The dataspace is driven by the async dispatcher.
|
|
||||||
# Without `runForever` this module would exit immediately.
|
|
|
@ -1,27 +0,0 @@
|
||||||
# SPDX-FileCopyrightText: 2021 ☭ Emery Hemingway
|
|
||||||
# SPDX-License-Identifier: Unlicense
|
|
||||||
|
|
||||||
import std/[asyncdispatch, monotimes, times]
|
|
||||||
import preserves, preserves/records
|
|
||||||
import syndicate
|
|
||||||
|
|
||||||
import syndicate/drivers/timers
|
|
||||||
|
|
||||||
syndicate plainTimerDemo:
|
|
||||||
boot timerDriver
|
|
||||||
|
|
||||||
spawn "laterThanDemo":
|
|
||||||
field(deadline, MonoTime, getMonoTime())
|
|
||||||
field(count, int, 0)
|
|
||||||
|
|
||||||
onAsserted(prsTimeLaterThan(deadline.get)) do ():
|
|
||||||
echo "TimeLaterThan ticked for deadline ", deadline.get
|
|
||||||
count.set(count.get.succ)
|
|
||||||
if count.get < 5:
|
|
||||||
deadline.set(getMonoTime() + initDuration(milliseconds = 500))
|
|
||||||
|
|
||||||
onStop:
|
|
||||||
echo "dataspace stopped"
|
|
||||||
quit(0)
|
|
||||||
|
|
||||||
runForever()
|
|
Loading…
Reference in New Issue