Skip to content

Commit

Permalink
Merge pull request #37 from LukasNysted/dev-prop
Browse files Browse the repository at this point in the history
TroupeCheck
  • Loading branch information
aslanix authored Aug 23, 2024
2 parents e60c6a8 + 036a934 commit 982a514
Show file tree
Hide file tree
Showing 42 changed files with 6,490 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ yarn-error.log
*.swp
bin/troupe
bin/understudy
trp-rt/out/
trp-rt/out/
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ libs:
$(COMPILER) ./lib/raft_debug.trp -l
$(COMPILER) ./lib/bst.trp -l
$(COMPILER) ./lib/localregistry.trp -l
$(COMPILER) ./lib/troupecheck.trp -l

test:
mkdir -p out
Expand Down
1 change: 1 addition & 0 deletions lib/lists.trp
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@ in
, ("length", length)
, ("append", append)
, ("partition", partition)
, ("nth", nth)
]
end
3 changes: 2 additions & 1 deletion lib/out/lists.exports
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ lookup
elem
length
append
partition
partition
nth
627 changes: 627 additions & 0 deletions lib/troupecheck.trp

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions tests/rt/pos/core/nth1.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
2024-06-09T16:24:36.820Z [RTM] info: Skipping network creation. Observe that all external IO operations will yield a runtime error.
>>> Main thread finished with value: 2@{}%{}
4 changes: 4 additions & 0 deletions tests/rt/pos/core/nth1.trp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import lists
let val ls = [1,2,3,4]
in nth ls 2
end
2 changes: 2 additions & 0 deletions tests/rt/pos/core/nth2.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
2024-06-09T16:28:52.670Z [RTM] info: Skipping network creation. Observe that all external IO operations will yield a runtime error.
>>> Main thread finished with value: true@{}%{}
8 changes: 8 additions & 0 deletions tests/rt/pos/core/nth2.trp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import lists
let val ls = ["ls", 3, 1/2, {r = 10, p = 7}]
val string = nth ls 1
val int = nth ls 2
val float = nth ls 3
val record = nth ls 4
in (getType string = "string") andalso (getType int = "number") andalso (getType float = "number") andalso (getType record = "record")
end
8 changes: 8 additions & 0 deletions troupecheck/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
TLOCAL=$(TROUPE)/local.sh

tc-tests:
$(TLOCAL) ./tc_tests/general-testing.trp
$(TLOCAL) ./tc_tests/userguide-tests.trp

tc-shrink-tests:
$(TLOCAL) ./tc_tests/shrinking-tests.trp
20 changes: 20 additions & 0 deletions troupecheck/battleship/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
MKID=node $(TROUPE)/rt/built/p2p/mkid.mjs
MKALIASES=node $(TROUPE)/rt/built/p2p/mkaliases.js
START=$(TROUPE)/network.sh

battleship-game:

$(START) battleship-game.trp --id=ids/battleship-game.json --port=6789 # --debug --debugp2p

battleship-player1:
$(START) battleship-player.trp --id=ids/battleship-player1.json --aliases=aliases.json # --debug --debugp2p

battleship-player2:
$(START) battleship-player.trp --id=ids/battleship-player2.json --aliases=aliases.json # --debug --debugp2p

create-network-identifiers:
mkdir -p ids
$(MKID) --outfile=ids/battleship-game.json
$(MKID) --outfile=ids/battleship-player1.json
$(MKID) --outfile=ids/battleship-player2.json
$(MKALIASES) --include ids/battleship-game.json --include ids/battleship-player1.json --include ids/battleship-player2.json --outfile aliases.json
8 changes: 8 additions & 0 deletions troupecheck/battleship/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Battleship game example

1. *First-time only* Run `make create-network-identifiers`. This command will create two network identifiers in the local subdirectory `ids/`, and an alias file with the generated identifiers.

2. Run the server by running `make battleship-game`
3. Open another terminal window and start player 1 by running `make battleship-player1`
4. Open another terminal window again and start player 2 by running `make battleship-player2`

1 change: 1 addition & 0 deletions troupecheck/battleship/aliases.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"battleship-game":"12D3KooWLz6JNygFFtyTjujjU29ivACgp9bxYGCHheoyfwxpgpv7","battleship-player1":"12D3KooWCCB5cy5eYhdrzPqUqYbmcQjKiKjBA8EH3jvtP5R6jkxc","battleship-player2":"12D3KooWQwT7Pv3vVTZjkhztwU4zzp3mNMQSstzkN2vvNai4uqNv"}
Loading

0 comments on commit 982a514

Please sign in to comment.