-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtests0.metta
64 lines (52 loc) · 2.01 KB
/
tests0.metta
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
;; The next few comments passes only to MeTTaLog
;;MeTTaLog: !(pragma! compiler full)
;;MeTTaLog: !(pragma! trace-on-fail False)
;;MeTTaLog: !(pragma! trace-on-pass False)
;;MeTTaLog: !(pragma! trace-on-error False)
;;MeTTaLog: !(pragma! trace-on-overflow False)
;;MeTTaLog: !(pragma! trace-on-load False)
!(import! &self NARS.metta)
;;MeTTaLog: !(pragma! trace-on-load True)
;;NAL tests
!(assertEqualToResult
(|- ((Garfield --> cat) (1.0 0.9)) ((cat --> animal) (1.0 0.9)))
;expected:
(((animal --> Garfield) (1.0 0.44751381215469616))
((Garfield --> animal) (1.0 0.81))))
!(assertEqualToResult
(|- ((Garfield --> carnivore) (1.0 0.9)) (((Garfield --> cat) ==> (Garfield --> carnivore)) (1.0 0.9)))
;expected:
(((Garfield --> cat) (1.0 0.44751381215469616))))
!(assertEqualToResult
(|- ((({ a b }) --> mwawa) (1.0 0.9)))
;expected:
(((({ a }) --> mwawa) (1.0 0.81))
((({ b }) --> mwawa) (1.0 0.81))))
!(assertEqualToResult
(|- (((a * b) --> R) (1.0 0.9)))
;expected:
(((a --> (R /1 b)) (1.0 0.81))
((b --> (R /2 a)) (1.0 0.81))))
!(assertEqualToResult
(|- ((R --> (a * b)) (1.0 0.9)))
;expected:
((((R \1 b) --> a) (1.0 0.81))
(((R \2 a) --> b) (1.0 0.81))))
!(assertEqualToResult
(|- ((A --> cat) (1.0 0.9)) ((B --> cat) (1.0 0.9)))
;expected:
(((B --> A) (1.0 0.44751381215469616))
(((A ~ B) --> cat) (0.0 0.81))
(((A | B) --> cat) (1.0 0.81))
((B <-> A) (1.0 0.44751381215469616))
(((A & B) --> cat) (1.0 0.81))))
!(assertEqualToResult
(|- (|- ((Garfield --> cat) (1.0 0.9)) ((cat --> animal) (1.0 0.9))) ((animal --> being) (1.0 0.9)))
;expected:
(((animal --> (Garfield | being)) (1.0 0.40276243093922653))
((animal --> (Garfield & being)) (1.0 0.40276243093922653))
((animal --> (Garfield - being)) (0.0 0.40276243093922653))
((being <-> Garfield) (1.0 0.28712091374556914))
((being --> Garfield) (1.0 0.28712091374556914))
((being --> Garfield) (1.0 0.42163100057836905))
((Garfield --> being) (1.0 0.7290000000000001))))