Skip to content
Snippets Groups Projects
Commit de42ec91 authored by dgelessus's avatar dgelessus
Browse files

Add some test notebooks

parent 340d053a
Branches
Tags
No related merge requests found
......@@ -4,3 +4,9 @@
# Generated
/kernelspec/prob2/kernel.json
# Python virtual environment
/env/
# Jupyter notebook checkpoints
.ipynb_checkpoints/
%% Cell type:markdown id: tags:
Expressions can be evaluated.
%% Cell type:code id: tags:
``` prob
123
```
%% Output
123
%% Cell type:code id: tags:
``` prob
123 + 456
```
%% Output
579
%% Cell type:code id: tags:
``` prob
{1, 2} \/ {5, 6}
```
%% Output
{1,2,5,6}
%% Cell type:code id: tags:
``` prob
1..5
```
%% Output
{1,2,3,4,5}
%% Cell type:code id: tags:
``` prob
MAXINT
```
%% Output
3
%% Cell type:markdown id: tags:
Solution variables are displayed.
%% Cell type:code id: tags:
``` prob
#xx.(xx : NAT1 & xx mod 3 = 0)
```
%% Output
TRUE (xx = 3)
%% Cell type:markdown id: tags:
`:help` can be used to list all commands, or get help for a specific command. `:?` is equivalent to `:help`.
%% Cell type:code id: tags:
``` prob
:help
```
%% Output
Type a valid B expression, or one of the following commands:
::echo Echoes the arguments and body back.
::load Load the machine source code from the body.
:? Display help for a specific command, or general help about the REPL.
:help Display help for a specific command, or general help about the REPL.
%% Cell type:code id: tags:
``` prob
:?
```
%% Output
Type a valid B expression, or one of the following commands:
::echo Echoes the arguments and body back.
::load Load the machine source code from the body.
:? Display help for a specific command, or general help about the REPL.
:help Display help for a specific command, or general help about the REPL.
%% Cell type:code id: tags:
``` prob
:help :help
```
%% Output
:? [COMMAND]
:help [COMMAND]
Display help for a specific command, or general help about the REPL.
%% Cell type:code id: tags:
``` prob
:? :?
```
%% Output
:? [COMMAND]
:help [COMMAND]
Display help for a specific command, or general help about the REPL.
%% Cell type:code id: tags:
``` prob
:help ::load
```
%% Output
::load
MACHINE
...
END
Load the machine source code from the body.
%% Cell type:markdown id: tags:
When looking up help for a command, the `:` or `::` can be left off of the command name.
%% Cell type:code id: tags:
``` prob
:help help
```
%% Output
:? [COMMAND]
:help [COMMAND]
Display help for a specific command, or general help about the REPL.
%% Cell type:code id: tags:
``` prob
:help ?
```
%% Output
:? [COMMAND]
:help [COMMAND]
Display help for a specific command, or general help about the REPL.
%% Cell type:code id: tags:
``` prob
:help load
```
%% Output
::load
MACHINE
...
END
Load the machine source code from the body.
%% Cell type:markdown id: tags:
But it's not possible to use the wrong number of colons.
%% Cell type:code id: tags:
``` prob
:help ::help
```
%% Output
:help: Cannot display help for unknown command "::help"
%% Cell type:code id: tags:
``` prob
:help :load
```
%% Output
:help: Cannot display help for unknown command ":load"
%% Cell type:markdown id: tags:
Unknown commands cannot be looked up.
%% Cell type:code id: tags:
``` prob
:help wrong
```
%% Output
:help: Cannot display help for unknown command "wrong"
%% Cell type:code id: tags:
``` prob
:help :wrong
```
%% Output
:help: Cannot display help for unknown command ":wrong"
%% Cell type:markdown id: tags:
Machines can be loaded from code in the notebook.
%% Cell type:code id: tags:
``` prob
::load
MACHINE things
SETS THINGS = {ONE, TWO, THREE, FOUR}
END
```
%% Output
[2018-05-10 19:11:33,924, T+6623] "Shell-0" de.prob.cli.PrologProcessProvider.makeProcess(PrologProcessProvider.java:64): [INFO] Starting ProB's Prolog Core. Path is /Users/david/.prob/prob2-3.2.10-SNAPSHOT/probcli.sh
[2018-05-10 19:11:36,660, T+9359] "Shell-0" de.prob.cli.PortPattern.setValue(PortPattern.java:30): [INFO] Server has started and listens on port 54371
[2018-05-10 19:11:36,661, T+9360] "Shell-0" de.prob.cli.InterruptRefPattern.setValue(InterruptRefPattern.java:29): [INFO] Server can receive user interrupts via reference 2398
[2018-05-10 19:11:36,664, T+9363] "ProB Output Logger for instance 4540b804" de.prob.cli.ProBInstance.readAndLog(ConsoleListener.java:48): [INFO] -- starting command loop --
[2018-05-10 19:11:36,691, T+9390] "ProB Output Logger for instance 4540b804" de.prob.cli.ProBInstance.readAndLog(ConsoleListener.java:48): [INFO] Connected: 127.0.0.1
[2018-05-10 19:11:36,829, T+9528] "ProB Output Logger for instance 4540b804" de.prob.cli.ProBInstance.readAndLog(ConsoleListener.java:48): [INFO] loading_classical_b(parser_version(2018-04-11 12:07:37.302),things,[/Users/Shared/Uni/SHK/ProB2/prob2-jupyter-kernel/notebooks/tests])
Loaded machine: things : []
%% Cell type:code id: tags:
``` prob
THINGS
```
%% Output
{ONE,TWO,THREE,FOUR}
%% Cell type:markdown id: tags:
Preference values can be specified.
%% Cell type:code id: tags:
``` prob
::load MININT=-5 MAXINT=5
MACHINE prefs
END
```
%% Output
[2018-05-10 19:11:37,170, T+9869] "Shell-0" de.prob.cli.PrologProcessProvider.makeProcess(PrologProcessProvider.java:64): [INFO] Starting ProB's Prolog Core. Path is /Users/david/.prob/prob2-3.2.10-SNAPSHOT/probcli.sh
[2018-05-10 19:11:39,169, T+11868] "Shell-0" de.prob.cli.PortPattern.setValue(PortPattern.java:30): [INFO] Server has started and listens on port 54475
[2018-05-10 19:11:39,171, T+11870] "Shell-0" de.prob.cli.InterruptRefPattern.setValue(InterruptRefPattern.java:29): [INFO] Server can receive user interrupts via reference 2406
[2018-05-10 19:11:39,178, T+11877] "ProB Output Logger for instance 4905453a" de.prob.cli.ProBInstance.readAndLog(ConsoleListener.java:48): [INFO] -- starting command loop --
[2018-05-10 19:11:39,229, T+11928] "ProB Output Logger for instance 4905453a" de.prob.cli.ProBInstance.readAndLog(ConsoleListener.java:48): [INFO] Connected: 127.0.0.1
[2018-05-10 19:11:39,370, T+12069] "ProB Output Logger for instance 4905453a" de.prob.cli.ProBInstance.readAndLog(ConsoleListener.java:48): [INFO] loading_classical_b(parser_version(2018-04-11 12:07:37.302),prefs,[/Users/Shared/Uni/SHK/ProB2/prob2-jupyter-kernel/notebooks/tests])
Loaded machine: prefs : []
%% Cell type:code id: tags:
``` prob
MININT..MAXINT
```
%% Output
{−5,−4,−3,−2,−1,0,1,2,3,4,5}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment