-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcall_tests_mw.metta
21 lines (16 loc) · 1.27 KB
/
call_tests_mw.metta
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
;; call-string!
!(assertEqualToResult (call-string! "member(1,[1,2,3])") (()))
!(assertEqualToResult (call-string! "member(1,[1,2,3])") ())
!(assertEqualToResult (call-string! "member(X,[1,2,3])") ((1) (2) (3)))
!(assertEqualToResult (call-string! "member(X,[[1,2],[3,4]])") (((1 2)) ((3 4))))
!(assertEqualToResult (call-string! "member([X,Y],[[1,2],[3,4]])") ((1 2) (3 4)))
;; call!
!(assertEqualToResult (call! parse_time "2006-12-08T15:29:44Z" iso_8601 1165591784.0) (True))
!(assertEqualToResult (call! parse_time "2006-12-08T15:29:44Z" iso_8601 $x) (True)) ;; handles metta variable (but doesn't return binding)
!(assertEqualToResult (call! parse_time "2006-12-08T15:29:44Z" iso_8601 X) (False)) ;; doesn't handle Prolog variable
!(assertEqualToResult (call! parse_time "2006-12-08T15:29:44Z" iso_8601 1165591700.0) (False))
;; call-p!
!(assertEqualToResult (call-p! parse_time "2006-12-08T15:29:44Z" iso_8601 1165591784.0) (True))
!(assertEqualToResult (call-p! parse_time "2006-12-08T15:29:44Z" iso_8601 $x) (True)) ;; handles metta variable (but doesn't return binding)
!(assertEqualToResult (call-p! parse_time "2006-12-08T15:29:44Z" iso_8601 X) (False)) ;; doesn't handle Prolog variable
!(assertEqualToResult (call-p! parse_time "2006-12-08T15:29:44Z" iso_8601 1165591700.0) (False))