Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
vilterp committed Jun 10, 2024
1 parent 14b4101 commit 886e358
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/actors/systems/kvSync/examples/bank.dd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ runMutation{from: "0", name: "Deposit", args: [10]}.
tickState{}?
----
application/datalog
tickState{actorID: "client0", state: ClientState{data: {"bob": [{"transactionID": "10698", "value": 10},{"transactionID": "4540893", "value": 20}]}, id: "0", liveQueries: {}, loginState: LoggedIn{loggingOut: false, token: "0.009657739204967151", username: "bob"}, mutationDefns: {"CreateAccount": Lambda{args: ["name"], body: Write{key: Var{name: "name"}, val: IntLit{val: 0}}}, "Deposit": Lambda{args: ["amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "balanceBefore"}], body: Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "balanceBefore"},Var{name: "amount"}], name: "+"}}}}, "Transfer": Lambda{args: ["toAccount","amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "fromBalance"},{"val": Read{default: 0, key: Var{name: "toAccount"}}, "varName": "toBalance"}], body: If{cond: Apply{args: [Var{name: "amount"},Var{name: "fromBalance"}], name: ">"}, ifFalse: Do{ops: [Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "fromBalance"},Var{name: "amount"}], name: "-"}},Write{key: Var{name: "toAccount"}, val: Apply{args: [Var{name: "toBalance"},Var{name: "amount"}], name: "+"}}]}, ifTrue: Abort{reason: StringLit{val: "balance not high enough"}}}}}, "Withdraw": Lambda{args: ["amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "balanceBefore"}], body: If{cond: Apply{args: [Var{name: "amount"},Var{name: "balanceBefore"}], name: ">"}, ifFalse: Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "balanceBefore"},Var{name: "amount"}], name: "-"}}, ifTrue: Abort{reason: StringLit{val: "balance not high enough"}}}}}}, randSeed: 5046918, time: 6, transactions: {"10698": {"clientTrace": [Read{key: "bob", transactionID: "-1"},Write{desc: Insert{after: {"transactionID": "10698", "value": 10}}, key: "bob"}], "fromMe": true, "invocation": Invocation{args: [10], name: "Deposit"}, "state": Committed{serverTimestamp: 0}, "writes": []}, "4540893": {"clientTrace": [Read{key: "bob", transactionID: "10698"},Write{desc: Update{after: {"transactionID": "4540893", "value": 20}, before: {"transactionID": "10698", "value": 10}}, key: "bob"}], "fromMe": true, "invocation": Invocation{args: [10], name: "Deposit"}, "state": Pending{sentTime: 5}, "writes": []}}}, tickID: 19}.
tickState{actorID: "client0", state: ClientState{data: {"bob": [{"transactionID": "10698", "value": 10},{"transactionID": "4540893", "value": 20}]}, id: "0", liveQueries: {}, loginState: LoggedIn{loggingOut: false, token: "0.009657739204967151", username: "bob"}, mutationDefns: {"CreateAccount": Lambda{args: ["name"], body: Write{key: Var{name: "name"}, val: IntLit{val: 0}}}, "Deposit": Lambda{args: ["amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "balanceBefore"}], body: Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "balanceBefore"},Var{name: "amount"}], name: "+"}}}}, "Transfer": Lambda{args: ["toAccount","amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "fromBalance"},{"val": Read{default: 0, key: Var{name: "toAccount"}}, "varName": "toBalance"}], body: If{cond: Apply{args: [Var{name: "amount"},Var{name: "fromBalance"}], name: ">"}, ifFalse: Do{ops: [Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "fromBalance"},Var{name: "amount"}], name: "-"}},Write{key: Var{name: "toAccount"}, val: Apply{args: [Var{name: "toBalance"},Var{name: "amount"}], name: "+"}}]}, ifTrue: Abort{reason: StringLit{val: "balance not high enough"}}}}}, "Withdraw": Lambda{args: ["amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "balanceBefore"}], body: If{cond: Apply{args: [Var{name: "amount"},Var{name: "balanceBefore"}], name: ">"}, ifFalse: Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "balanceBefore"},Var{name: "amount"}], name: "-"}}, ifTrue: Abort{reason: StringLit{val: "balance not high enough"}}}}}}, randSeed: 5046918, time: 7, transactions: {"10698": {"clientTrace": [Read{key: "bob", transactionID: "-1"},Write{desc: Insert{after: {"transactionID": "10698", "value": 10}}, key: "bob"}], "fromMe": true, "invocation": Invocation{args: [10], name: "Deposit"}, "state": Committed{serverTimestamp: 0}, "writes": []}, "4540893": {"clientTrace": [Read{key: "bob", transactionID: "10698"},Write{desc: Update{after: {"transactionID": "4540893", "value": 20}, before: {"transactionID": "10698", "value": 10}}, key: "bob"}], "fromMe": true, "invocation": Invocation{args: [10], name: "Deposit"}, "state": Committed{serverTimestamp: 1}, "writes": []}}}, tickID: 23}.
tickState{actorID: "client0", state: ClientState{data: {"bob": [{"transactionID": "10698", "value": 10}]}, id: "0", liveQueries: {}, loginState: LoggedIn{loggingOut: false, token: "0.009657739204967151", username: "bob"}, mutationDefns: {"CreateAccount": Lambda{args: ["name"], body: Write{key: Var{name: "name"}, val: IntLit{val: 0}}}, "Deposit": Lambda{args: ["amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "balanceBefore"}], body: Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "balanceBefore"},Var{name: "amount"}], name: "+"}}}}, "Transfer": Lambda{args: ["toAccount","amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "fromBalance"},{"val": Read{default: 0, key: Var{name: "toAccount"}}, "varName": "toBalance"}], body: If{cond: Apply{args: [Var{name: "amount"},Var{name: "fromBalance"}], name: ">"}, ifFalse: Do{ops: [Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "fromBalance"},Var{name: "amount"}], name: "-"}},Write{key: Var{name: "toAccount"}, val: Apply{args: [Var{name: "toBalance"},Var{name: "amount"}], name: "+"}}]}, ifTrue: Abort{reason: StringLit{val: "balance not high enough"}}}}}, "Withdraw": Lambda{args: ["amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "balanceBefore"}], body: If{cond: Apply{args: [Var{name: "amount"},Var{name: "balanceBefore"}], name: ">"}, ifFalse: Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "balanceBefore"},Var{name: "amount"}], name: "-"}}, ifTrue: Abort{reason: StringLit{val: "balance not high enough"}}}}}}, randSeed: 2502798, time: 4, transactions: {"10698": {"clientTrace": [Read{key: "bob", transactionID: "-1"},Write{desc: Insert{after: {"transactionID": "10698", "value": 10}}, key: "bob"}], "fromMe": true, "invocation": Invocation{args: [10], name: "Deposit"}, "state": Pending{sentTime: 3}, "writes": []}}}, tickID: 12}.
tickState{actorID: "client0", state: ClientState{data: {"bob": [{"transactionID": "10698", "value": 10}]}, id: "0", liveQueries: {}, loginState: LoggedIn{loggingOut: false, token: "0.009657739204967151", username: "bob"}, mutationDefns: {"CreateAccount": Lambda{args: ["name"], body: Write{key: Var{name: "name"}, val: IntLit{val: 0}}}, "Deposit": Lambda{args: ["amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "balanceBefore"}], body: Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "balanceBefore"},Var{name: "amount"}], name: "+"}}}}, "Transfer": Lambda{args: ["toAccount","amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "fromBalance"},{"val": Read{default: 0, key: Var{name: "toAccount"}}, "varName": "toBalance"}], body: If{cond: Apply{args: [Var{name: "amount"},Var{name: "fromBalance"}], name: ">"}, ifFalse: Do{ops: [Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "fromBalance"},Var{name: "amount"}], name: "-"}},Write{key: Var{name: "toAccount"}, val: Apply{args: [Var{name: "toBalance"},Var{name: "amount"}], name: "+"}}]}, ifTrue: Abort{reason: StringLit{val: "balance not high enough"}}}}}, "Withdraw": Lambda{args: ["amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "balanceBefore"}], body: If{cond: Apply{args: [Var{name: "amount"},Var{name: "balanceBefore"}], name: ">"}, ifFalse: Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "balanceBefore"},Var{name: "amount"}], name: "-"}}, ifTrue: Abort{reason: StringLit{val: "balance not high enough"}}}}}}, randSeed: 2502798, time: 5, transactions: {"10698": {"clientTrace": [Read{key: "bob", transactionID: "-1"},Write{desc: Insert{after: {"transactionID": "10698", "value": 10}}, key: "bob"}], "fromMe": true, "invocation": Invocation{args: [10], name: "Deposit"}, "state": Committed{serverTimestamp: 0}, "writes": []}}}, tickID: 16}.
tickState{actorID: "client0", state: ClientState{data: {"bob": [{"transactionID": "10698", "value": 10}]}, id: "0", liveQueries: {}, loginState: LoggedIn{loggingOut: false, token: "0.009657739204967151", username: "bob"}, mutationDefns: {"CreateAccount": Lambda{args: ["name"], body: Write{key: Var{name: "name"}, val: IntLit{val: 0}}}, "Deposit": Lambda{args: ["amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "balanceBefore"}], body: Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "balanceBefore"},Var{name: "amount"}], name: "+"}}}}, "Transfer": Lambda{args: ["toAccount","amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "fromBalance"},{"val": Read{default: 0, key: Var{name: "toAccount"}}, "varName": "toBalance"}], body: If{cond: Apply{args: [Var{name: "amount"},Var{name: "fromBalance"}], name: ">"}, ifFalse: Do{ops: [Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "fromBalance"},Var{name: "amount"}], name: "-"}},Write{key: Var{name: "toAccount"}, val: Apply{args: [Var{name: "toBalance"},Var{name: "amount"}], name: "+"}}]}, ifTrue: Abort{reason: StringLit{val: "balance not high enough"}}}}}, "Withdraw": Lambda{args: ["amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "balanceBefore"}], body: If{cond: Apply{args: [Var{name: "amount"},Var{name: "balanceBefore"}], name: ">"}, ifFalse: Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "balanceBefore"},Var{name: "amount"}], name: "-"}}, ifTrue: Abort{reason: StringLit{val: "balance not high enough"}}}}}}, randSeed: 5046918, time: 6, transactions: {"10698": {"clientTrace": [Read{key: "bob", transactionID: "-1"},Write{desc: Insert{after: {"transactionID": "10698", "value": 10}}, key: "bob"}], "fromMe": true, "invocation": Invocation{args: [10], name: "Deposit"}, "state": Committed{serverTimestamp: 0}, "writes": []}, "4540893": {"clientTrace": [Read{key: "bob", transactionID: "10698"},Write{desc: Update{after: {"transactionID": "4540893", "value": 20}, before: {"transactionID": "10698", "value": 10}}, key: "bob"}], "fromMe": true, "invocation": Invocation{args: [10], name: "Deposit"}, "state": Pending{sentTime: 5}, "writes": []}}}, tickID: 19}.
tickState{actorID: "client0", state: ClientState{data: {"bob": [{"transactionID": "10698", "value": 10}]}, id: "0", liveQueries: {}, loginState: LoggedIn{loggingOut: false, token: "0.009657739204967151", username: "bob"}, mutationDefns: {"CreateAccount": Lambda{args: ["name"], body: Write{key: Var{name: "name"}, val: IntLit{val: 0}}}, "Deposit": Lambda{args: ["amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "balanceBefore"}], body: Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "balanceBefore"},Var{name: "amount"}], name: "+"}}}}, "Transfer": Lambda{args: ["toAccount","amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "fromBalance"},{"val": Read{default: 0, key: Var{name: "toAccount"}}, "varName": "toBalance"}], body: If{cond: Apply{args: [Var{name: "amount"},Var{name: "fromBalance"}], name: ">"}, ifFalse: Do{ops: [Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "fromBalance"},Var{name: "amount"}], name: "-"}},Write{key: Var{name: "toAccount"}, val: Apply{args: [Var{name: "toBalance"},Var{name: "amount"}], name: "+"}}]}, ifTrue: Abort{reason: StringLit{val: "balance not high enough"}}}}}, "Withdraw": Lambda{args: ["amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "balanceBefore"}], body: If{cond: Apply{args: [Var{name: "amount"},Var{name: "balanceBefore"}], name: ">"}, ifFalse: Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "balanceBefore"},Var{name: "amount"}], name: "-"}}, ifTrue: Abort{reason: StringLit{val: "balance not high enough"}}}}}}, randSeed: 5046918, time: 7, transactions: {"10698": {"clientTrace": [Read{key: "bob", transactionID: "-1"},Write{desc: Insert{after: {"transactionID": "10698", "value": 10}}, key: "bob"}], "fromMe": true, "invocation": Invocation{args: [10], name: "Deposit"}, "state": Committed{serverTimestamp: 0}, "writes": []}}}, tickID: 23}.
tickState{actorID: "client0", state: ClientState{data: {}, id: "0", liveQueries: {}, loginState: LoggedIn{loggingOut: false, token: "0.009657739204967151", username: "bob"}, mutationDefns: {"CreateAccount": Lambda{args: ["name"], body: Write{key: Var{name: "name"}, val: IntLit{val: 0}}}, "Deposit": Lambda{args: ["amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "balanceBefore"}], body: Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "balanceBefore"},Var{name: "amount"}], name: "+"}}}}, "Transfer": Lambda{args: ["toAccount","amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "fromBalance"},{"val": Read{default: 0, key: Var{name: "toAccount"}}, "varName": "toBalance"}], body: If{cond: Apply{args: [Var{name: "amount"},Var{name: "fromBalance"}], name: ">"}, ifFalse: Do{ops: [Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "fromBalance"},Var{name: "amount"}], name: "-"}},Write{key: Var{name: "toAccount"}, val: Apply{args: [Var{name: "toBalance"},Var{name: "amount"}], name: "+"}}]}, ifTrue: Abort{reason: StringLit{val: "balance not high enough"}}}}}, "Withdraw": Lambda{args: ["amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "balanceBefore"}], body: If{cond: Apply{args: [Var{name: "amount"},Var{name: "balanceBefore"}], name: ">"}, ifFalse: Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "balanceBefore"},Var{name: "amount"}], name: "-"}}, ifTrue: Abort{reason: StringLit{val: "balance not high enough"}}}}}}, randSeed: 48, time: 3, transactions: {}}, tickID: 9}.
tickState{actorID: "client0", state: ClientState{data: {}, id: "0", liveQueries: {}, loginState: LoggedOut{loggingInAs: "bob"}, mutationDefns: {"CreateAccount": Lambda{args: ["name"], body: Write{key: Var{name: "name"}, val: IntLit{val: 0}}}, "Deposit": Lambda{args: ["amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "balanceBefore"}], body: Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "balanceBefore"},Var{name: "amount"}], name: "+"}}}}, "Transfer": Lambda{args: ["toAccount","amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "fromBalance"},{"val": Read{default: 0, key: Var{name: "toAccount"}}, "varName": "toBalance"}], body: If{cond: Apply{args: [Var{name: "amount"},Var{name: "fromBalance"}], name: ">"}, ifFalse: Do{ops: [Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "fromBalance"},Var{name: "amount"}], name: "-"}},Write{key: Var{name: "toAccount"}, val: Apply{args: [Var{name: "toBalance"},Var{name: "amount"}], name: "+"}}]}, ifTrue: Abort{reason: StringLit{val: "balance not high enough"}}}}}, "Withdraw": Lambda{args: ["amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "balanceBefore"}], body: If{cond: Apply{args: [Var{name: "amount"},Var{name: "balanceBefore"}], name: ">"}, ifFalse: Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "balanceBefore"},Var{name: "amount"}], name: "-"}}, ifTrue: Abort{reason: StringLit{val: "balance not high enough"}}}}}}, randSeed: 48, time: 2, transactions: {}}, tickID: 5}.
tickState{actorID: "client0", state: ClientState{data: {}, id: "0", liveQueries: {}, loginState: LoggedOut{loggingInAs: null{}}, mutationDefns: {"CreateAccount": Lambda{args: ["name"], body: Write{key: Var{name: "name"}, val: IntLit{val: 0}}}, "Deposit": Lambda{args: ["amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "balanceBefore"}], body: Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "balanceBefore"},Var{name: "amount"}], name: "+"}}}}, "Transfer": Lambda{args: ["toAccount","amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "fromBalance"},{"val": Read{default: 0, key: Var{name: "toAccount"}}, "varName": "toBalance"}], body: If{cond: Apply{args: [Var{name: "amount"},Var{name: "fromBalance"}], name: ">"}, ifFalse: Do{ops: [Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "fromBalance"},Var{name: "amount"}], name: "-"}},Write{key: Var{name: "toAccount"}, val: Apply{args: [Var{name: "toBalance"},Var{name: "amount"}], name: "+"}}]}, ifTrue: Abort{reason: StringLit{val: "balance not high enough"}}}}}, "Withdraw": Lambda{args: ["amount"], body: Let{bindings: [{"val": Read{default: 0, key: Var{name: "curUser"}}, "varName": "balanceBefore"}], body: If{cond: Apply{args: [Var{name: "amount"},Var{name: "balanceBefore"}], name: ">"}, ifFalse: Write{key: Var{name: "curUser"}, val: Apply{args: [Var{name: "balanceBefore"},Var{name: "amount"}], name: "-"}}, ifTrue: Abort{reason: StringLit{val: "balance not high enough"}}}}}}, randSeed: 48, time: 1, transactions: {}}, tickID: 2}.
Expand Down

0 comments on commit 886e358

Please sign in to comment.