Commit 5bb1866f authored by Mart Lubbers's avatar Mart Lubbers

Merge branch 'foreverSt' into 'master'

fix foreverSt & add test

See merge request !334
parents 1bc0bbc7 d40a7d29
Pipeline #30628 passed with stage
in 5 minutes and 52 seconds
......@@ -104,7 +104,7 @@ foreverIf :: (a -> Bool) !(Task a) -> Task a | iTask a
foreverIf pred task = step task id [OnValue $ withStable \v->Just (if (pred v) (foreverIf pred task) (return v))]
foreverSt :: a !(a -> Task a) -> Task a | iTask a
foreverSt st t = step (t st) id [OnValue $ withStable $ Just o forever o t]
foreverSt st t = step (t st) id [OnValue $ withStable $ \st -> Just $ foreverSt st t]
forever :: (Task a) -> Task a | iTask a
forever t = step t id [OnValue $ withStable \_->Just $ forever t]
......
Version: 1.4
Global
ProjectRoot: .
Target: iTasks
Exec: {Project}*iTasks.WF.Combinators.Common.UnitTests
ByteCode: {Project}*iTasks.WF.Combinators.Common.UnitTests.bc
CodeGen
CheckStacks: False
CheckIndexes: True
OptimiseABC: True
GenerateByteCode: True
Application
HeapSize: 20971520
StackSize: 512000
ExtraMemory: 8192
IntialHeapSize: 204800
HeapSizeMultiplier: 4096
ShowExecutionTime: False
ShowGC: False
ShowStackSize: False
MarkingCollector: False
DisableRTSFlags: False
StandardRuntimeEnv: True
Profile
Memory: False
MemoryMinimumHeapSize: 0
Time: False
Stack: False
Dynamics: True
GenericFusion: False
DescExL: True
Output
Output: NoConsole
Font: Monaco
FontSize: 9
WriteStdErr: False
Link
LinkMethod: Static
GenerateRelocations: False
GenerateSymbolTable: False
GenerateLinkMap: False
LinkResources: False
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
KeepByteCodeSymbols: True
PrelinkByteCode: True
Paths
Path: {Project}
Path: {Project}*..*..*Libraries
Path: {Application}*lib*Dynamics
Path: {Application}*lib*GraphCopy
Path: {Application}*lib*ABCInterpreter
Path: {Application}*lib*StdEnv
Path: {Application}*lib*TCPIP
Path: {Application}*lib*Platform
Path: {Application}*lib*Platform*Deprecated*StdLib
Precompile:
Postlink:
MainModule
Name: iTasks.WF.Combinators.Common.UnitTests
Dir: {Project}
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
module iTasks.WF.Combinators.Common.UnitTests
import Data.Func, Data.Either
import qualified Data.Set as Set
import qualified Data.Map as Map
import iTasks.Util.Testing
Start world = runUnitTests tests world
tests = [foreverStStateChange]
foreverStStateChange = testTaskOutput "foreverSt state change" task events exp checkEqual
where
task = foreverSt 0 (\st -> if (st < n) (return $ inc st) (viewInformation [] st))
events = [Left ResetEvent]
exp = [TOUIChange $ ReplaceUI $ UI UITextView attrs []]
where
attrs =
'Map'.fromList
[("value", JSONString $ toString n), ("class", JSONArray [JSONString "step", JSONString "interact"])]
n = 100
derive gPrint TaskOutputMessage, UIChange, UIChildChange, UIAttributeChange, UI, UIType, Map, JSONNode
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment