-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clearer thinking: is_memory_for_type should use == rather than <:.
- Loading branch information
1 parent
24bb484
commit 5b4e6a5
Showing
5 changed files
with
53 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
abstract type AbstractThing end | ||
|
||
struct Thing1 <: AbstractThing | ||
c::Char | ||
end | ||
|
||
struct Thing2 <: AbstractThing | ||
c::Char | ||
end | ||
|
||
@rule JuxtaposeAbstractThingsRule(t1::AbstractThing, t2::AbstractThing, ::Tuple) begin | ||
emit((t1.c, t2.c)) | ||
end | ||
|
||
@rule JuxtaposeThings12Rule(t1::Thing1, t2::Thing2, ::String) begin | ||
emit("$(t1.c)$(t2.c)") | ||
end | ||
|
||
@testset "test thing/subthing" begin | ||
root = ReteRootNode("root") | ||
install(root, JuxtaposeAbstractThingsRule) | ||
install(root, JuxtaposeThings12Rule) | ||
for c in 'a':'c' | ||
receive(root, Thing1(c)) | ||
end | ||
for c in 'd':'e' | ||
receive(root, Thing2(c)) | ||
end | ||
@test askc(Counter(), root, Thing1) == 3 | ||
@test askc(Counter(), root, Thing2) == 2 | ||
@test askc(Counter(), root, AbstractThing) == 5 | ||
@test askc(Counter(), root, String) == 6 | ||
@test askc(Counter(), root, Tuple) == 25 | ||
end | ||
|
||
|