Skip to content

Commit

Permalink
move example code to examples
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Nov 15, 2024
1 parent 10c59ec commit e1f080a
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 38 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ inet-cute help [name] # Display help for a command

## Examples

Please see [tests/](./tests) for some example code.
Please see [examples/](./tests) for some example code.

### Nat

Expand Down Expand Up @@ -116,7 +116,7 @@ rule cons append
result-(append)
end
import zero from "https://code-of-inet-cute.xieyuheng.com/tests/datatype/Nat.i"
import zero from "https://code-of-inet-cute.xieyuheng.com/examples/datatype/Nat.i"
null zero cons zero cons
null zero cons zero cons
Expand All @@ -130,7 +130,7 @@ append @run $result
### DiffList

```inet
import List from "https://code-of-inet-cute.xieyuheng.com/tests/datatype/List.i"
import List from "https://code-of-inet-cute.xieyuheng.com/examples/datatype/List.i"
// Concatenation of lists is performed in linear time
// with respect to its first argument.
Expand Down Expand Up @@ -172,8 +172,8 @@ rule diff diffOpen
(diff)-front oldBack-(diffOpen)
end
import zero from "https://code-of-inet-cute.xieyuheng.com/tests/datatype/Nat.i"
import cons from "https://code-of-inet-cute.xieyuheng.com/tests/datatype/List.i"
import zero from "https://code-of-inet-cute.xieyuheng.com/examples/datatype/Nat.i"
import cons from "https://code-of-inet-cute.xieyuheng.com/examples/datatype/List.i"
(diff) @spread $front $back $value
back zero cons zero cons front @connect value
Expand Down
10 changes: 5 additions & 5 deletions docs/articles/programming-with-interaction-nets.md
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ to a local variable named `local`.
import
Nat, zero, add1, add,
one, two, three,
from "https://code-of-inet-cute.xieyuheng.com/tests/datatype/Nat.i"
from "https://code-of-inet-cute.xieyuheng.com/examples/datatype/Nat.i"
node natErase
Nat :target!
Expand Down Expand Up @@ -892,7 +892,7 @@ rule cons append
result-(append)
end
import zero from "https://code-of-inet-cute.xieyuheng.com/tests/datatype/Nat.i"
import zero from "https://code-of-inet-cute.xieyuheng.com/examples/datatype/Nat.i"
null zero cons zero cons
null zero cons zero cons
Expand Down Expand Up @@ -937,7 +937,7 @@ in reverse order of the definition,
then we save the ports to local variables for later use.

```
import List from "https://code-of-inet-cute.xieyuheng.com/tests/datatype/List.i"
import List from "https://code-of-inet-cute.xieyuheng.com/examples/datatype/List.i"
type DiffList @Type -- @Type end
Expand Down Expand Up @@ -972,8 +972,8 @@ rule diff diffOpen
(diff)-front oldBack-(diffOpen)
end
import zero from "https://code-of-inet-cute.xieyuheng.com/tests/datatype/Nat.i"
import cons from "https://code-of-inet-cute.xieyuheng.com/tests/datatype/List.i"
import zero from "https://code-of-inet-cute.xieyuheng.com/examples/datatype/Nat.i"
import cons from "https://code-of-inet-cute.xieyuheng.com/examples/datatype/List.i"
(diff) @spread $front $back $value
back zero cons zero cons front @connect value
Expand Down
10 changes: 5 additions & 5 deletions docs/articles/反应网编程.md
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ three two max
import
Nat, zero, add1, add,
one, two, three,
from "https://code-of-inet-cute.xieyuheng.com/tests/datatype/Nat.i"
from "https://code-of-inet-cute.xieyuheng.com/examples/datatype/Nat.i"
node natErase
Nat :target!
Expand Down Expand Up @@ -861,7 +861,7 @@ rule cons append
result-(append)
end
import zero from "https://code-of-inet-cute.xieyuheng.com/tests/datatype/Nat.i"
import zero from "https://code-of-inet-cute.xieyuheng.com/examples/datatype/Nat.i"
null zero cons zero cons
null zero cons zero cons
Expand Down Expand Up @@ -900,7 +900,7 @@ append @run $result
然后我们把这些接口保存到了一些局部变量中。

```
import List from "https://code-of-inet-cute.xieyuheng.com/tests/datatype/List.i"
import List from "https://code-of-inet-cute.xieyuheng.com/examples/datatype/List.i"
type DiffList @Type -- @Type end
Expand Down Expand Up @@ -935,8 +935,8 @@ rule diff diffOpen
(diff)-front oldBack-(diffOpen)
end
import zero from "https://code-of-inet-cute.xieyuheng.com/tests/datatype/Nat.i"
import cons from "https://code-of-inet-cute.xieyuheng.com/tests/datatype/List.i"
import zero from "https://code-of-inet-cute.xieyuheng.com/examples/datatype/Nat.i"
import cons from "https://code-of-inet-cute.xieyuheng.com/examples/datatype/List.i"
(diff) @spread $front $back $value
back zero cons zero cons front @connect value
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"build": "tsc",
"build:watch": "tsc --watch",
"test:ts": "vitest --dir src --run",
"test:inet": "test-runner snapshot 'node ./bin/inet-cute.js run --no-color' 'tests/**/*.i' --exclude 'tests/**/*.error.i'",
"test:inet-error": "test-runner snapshot-error 'node ./bin/inet-cute.js run --no-color' 'tests/**/*.error.i'",
"test:inet": "test-runner snapshot 'node ./bin/inet-cute.js run --no-color' 'examples/**/*.i' --exclude 'examples/**/*.error.i'",
"test:inet-error": "test-runner snapshot-error 'node ./bin/inet-cute.js run --no-color' 'examples/**/*.error.i'",
"test": "npm run test:ts && npm run test:inet && npm run test:inet-error",
"format": "prettier src docs --write"
},
Expand Down
4 changes: 2 additions & 2 deletions src/command-line/commands/Run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ export class Run extends Command<Args, Opts> {
return [
`Run a file:`,
``,
blue(` ${runner.name} ${this.name} tests/datatype/Nat.test.i`),
blue(` ${runner.name} ${this.name} examples/datatype/Nat.test.i`),
``,
`Run a URL:`,
``,
blue(` ${runner.name} ${this.name} https://code-of-inet-cute.xieyuheng.com/tests/datatype/Nat.test.i`),
blue(` ${runner.name} ${this.name} https://code-of-inet-cute.xieyuheng.com/examples/datatype/Nat.test.i`),

``,
].join("\n")
Expand Down
4 changes: 2 additions & 2 deletions tests/module/circular-import-1.error.i.err
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Import.execute] I can not do circular import.

loading module url: tests/module/circular-import-3.error.i
requiring module url: tests/module/circular-import-1.error.i
loading module url: examples/module/circular-import-3.error.i
requiring module url: examples/module/circular-import-1.error.i

[Import.execute] I fail to import module.

Expand Down
4 changes: 2 additions & 2 deletions tests/module/circular-import-2.error.i.err
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Import.execute] I can not do circular import.

loading module url: tests/module/circular-import-1.error.i
requiring module url: tests/module/circular-import-2.error.i
loading module url: examples/module/circular-import-1.error.i
requiring module url: examples/module/circular-import-2.error.i

[Import.execute] I fail to import module.

Expand Down
4 changes: 2 additions & 2 deletions tests/module/circular-import-3.error.i.err
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Import.execute] I can not do circular import.

loading module url: tests/module/circular-import-2.error.i
requiring module url: tests/module/circular-import-3.error.i
loading module url: examples/module/circular-import-2.error.i
requiring module url: examples/module/circular-import-3.error.i

[Import.execute] I fail to import module.

Expand Down
4 changes: 2 additions & 2 deletions tests/module/circular-require-1.error.i.err
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Require.execute] I can not do circular require.

loading module url: tests/module/circular-require-3.error.i
requiring module url: tests/module/circular-require-1.error.i
loading module url: examples/module/circular-require-3.error.i
requiring module url: examples/module/circular-require-1.error.i

[Require.execute] I fail to require module.

Expand Down
4 changes: 2 additions & 2 deletions tests/module/circular-require-2.error.i.err
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Require.execute] I can not do circular require.

loading module url: tests/module/circular-require-1.error.i
requiring module url: tests/module/circular-require-2.error.i
loading module url: examples/module/circular-require-1.error.i
requiring module url: examples/module/circular-require-2.error.i

[Require.execute] I fail to require module.

Expand Down
4 changes: 2 additions & 2 deletions tests/module/circular-require-3.error.i.err
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Require.execute] I can not do circular require.

loading module url: tests/module/circular-require-2.error.i
requiring module url: tests/module/circular-require-3.error.i
loading module url: examples/module/circular-require-2.error.i
requiring module url: examples/module/circular-require-3.error.i

[Require.execute] I fail to require module.

Expand Down
6 changes: 3 additions & 3 deletions tests/module/define-rule-for-non-own-node.error.i.err
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[checkRuleIsAboutOwnNode] To define a rule, one of the node must be owned by this module.

loading module url: tests/module/define-rule-for-non-own-node.error.i
first node module url: tests/datatype/Nat.i
second node module url: tests/datatype/Nat.i
loading module url: examples/module/define-rule-for-non-own-node.error.i
first node module url: examples/datatype/Nat.i
second node module url: examples/datatype/Nat.i

[DefineRule.execute] I fail to define rule.

Expand Down
4 changes: 2 additions & 2 deletions tests/module/self-import.error.i.err
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Import.execute] I can not do circular import.

loading module url: tests/module/self-import.error.i
requiring module url: tests/module/self-import.error.i
loading module url: examples/module/self-import.error.i
requiring module url: examples/module/self-import.error.i

[Import.execute] I fail to import module.

Expand Down
4 changes: 2 additions & 2 deletions tests/module/self-require.error.i.err
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Require.execute] I can not do circular require.

loading module url: tests/module/self-require.error.i
requiring module url: tests/module/self-require.error.i
loading module url: examples/module/self-require.error.i
requiring module url: examples/module/self-require.error.i

[Require.execute] I fail to require module.

Expand Down

0 comments on commit e1f080a

Please sign in to comment.