Skip to content

Commit

Permalink
Merge pull request #10 from AdrickTench/master
Browse files Browse the repository at this point in the history
ci.yml changes and some tests
  • Loading branch information
TeamSPoon authored Dec 13, 2024
2 parents e18678d + 7071e1b commit 8cd9211
Show file tree
Hide file tree
Showing 1,878 changed files with 8,592,877 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
generate-reports:
runs-on: ubuntu-latest

if: (github.repository == 'logicmoo/metta-testsuite')
if: (github.repository == 'logicmoo/metta-testsuite') || (github.event_name != 'schedule')

env:
JOB_TYPE: ${{ github.event_name == 'schedule' && 'nightly' || 'ci' }}
Expand Down
463 changes: 463 additions & 0 deletions reports/NewResults.md

Large diffs are not rendered by default.

4,588 changes: 4,588 additions & 0 deletions reports/PASS_FAIL.md

Large diffs are not rendered by default.

428 changes: 428 additions & 0 deletions reports/README.md

Large diffs are not rendered by default.

Empty file added reports/SHARED.UNITS.LOCAL.md
Empty file.
454 changes: 454 additions & 0 deletions reports/SHARED.UNITS.PREV.md

Large diffs are not rendered by default.

881 changes: 881 additions & 0 deletions reports/TEST_LINKS.md

Large diffs are not rendered by default.

591 changes: 591 additions & 0 deletions reports/prolog_codes_analyses.htm

Large diffs are not rendered by default.

1,661 changes: 1,661 additions & 0 deletions tests/README.md

Large diffs are not rendered by default.

1,521 changes: 1,521 additions & 0 deletions tests/autoexec.metta

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion tests/baseline_compat/metta-morph_tests/test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
echo "Testing:" $1
sh run.sh $1 2> /dev/null | grep "!=" && echo "FAILED:" $1

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

; 20241014 r.v.v converted metta-lang.dev to metta
; !(assertEqualToResult ( ) ( ) )
; This line will be ignored.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

; 20241014 r.v.v converted metta-lang.dev to metta
; !(assertEqualToResult ( ) ( ) )
(= (brother Mike) Tom)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

; 20241014 r.v.v converted metta-lang.dev to metta
; !(assertEqualToResult ( ) ( ) )

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

; 20241014 r.v.v converted metta-lang.dev to metta
; !(assertEqualToResult ( ) ( ) )
; This function accepts an atom of type A and returns an atom of type B
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

; 20241014 r.v.v converted metta-lang.dev to metta

(Parent Bob Ann)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

; 20241014 r.v.v converted metta-lang.dev to metta
; !(assertEqualToResult ( ) ( ) )

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

; 20241014 r.v.v converted metta-lang.dev to metta
; !(assertEqualToResult ( ) ( ) )

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

; 20241014 r.v.v converted metta-lang.dev to metta
; !(assertEqualToResult ( ) ( ) )
; aa
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

; 20241014 r.v.v converted metta-lang.dev to metta
; !(assertEqualToResult ( ) ( ) )

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

; 20241014 r.v.v converted metta-lang.dev to metta
; !(assertEqualToResult ( ) ( ) )

Expand Down
80 changes: 80 additions & 0 deletions tests/compiler_baseline/anti-regression/bc_comp.metta
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@

!(pp-about! get-metatype)
(: is-variable (-> Atom Bool))
(= (is-variable $x) (== (get-metatype $x) Variable))

(: lazy-or (-> Bool Atom Bool))
(= (lazy-or False $x) $x)
(= (lazy-or True $x) True)

(: is-expression (-> Atom Bool))
(= (is-expression $x) (== (get-metatype $x) Expression))

(: is-closed (-> Atom Bool))
(= (is-closed $x) (if (is-variable $x)
False
(if (== () $x) True
(if (is-expression $x)
(and (let $head (car-atom $x) (is-closed $head))
(let $tail (cdr-atom $x) (is-closed $tail)))
True))))


;; KB
!(bind! &kb (new-space))

!(add-atom &kb (: axiom (nums 2 3)))

!(add-atom &kb (: rule1
(-> (nums $x $y)
(rule1output $x $y))))

!(add-atom &kb
(: rule
(-> (rule1output $x $y)
(-> (⍃ $x $y)
(less $x $y)))))

; !(add-atom &kb
; (: rule
; (-> (⍃ $x $y)
; (-> (rule1output $x $y)
; (less $x $y)))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; DTL Backward chaining Curried ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(: bc (-> $a hyperon::space::DynSpace Nat $a))
;; Base case
(= (bc (: $prf $ccln) $space $_1)
(match $space (: $prf $ccln) (: $prf $ccln)))
;; if conclusion equals (⍃ $X $Y), then return (: CPU (⍃ $X $Y))
;; if $x and $Y are fully grounded and (< $X $Y)
(= (bc (: CPU (⍃ $X $Y)) $space $_2)
(if (and (and (is-closed $X) (is-closed $Y)) (< $X $Y))
(: CPU (⍃ $X $Y))
(empty)))

;; Recursive step
(= (bc (: ($prfabs $prfarg) $ccln) $space (S $k))
(let* (((: $prfabs (-> $prms $ccln))
(bc (: $prfabs (-> $prms $ccln)) $space $k))
((: $prfarg $prms)
(bc (: $prfarg $prms) $space $k)))

(: ($prfabs $prfarg) $ccln)))


; Test
!(bc (: CPU (⍃ 2 3)) &kb Z)
!(bc (: CPU (⍃ 4 3)) &kb Z)

; !(pragma! eval debug)

;! ( rtrace! (bc (: $prf (less $x $y)) (S (S (S Z)))))

!(bc (: $prf (less $x $y)) &kb (S (S (S Z))))


79 changes: 79 additions & 0 deletions tests/compiler_baseline/anti-regression/bchain.metta
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
!(pragma! compile False)

(: is-variable (-> Atom Bool))
(= (is-variable $x) (== (get-metatype $x) Variable))

(: lazy-or (-> Bool Atom Bool))
(= (lazy-or False $x) $x)
(= (lazy-or True $x) True)

(: is-expression (-> Atom Bool))
(= (is-expression $x) (== (get-metatype $x) Expression))

(: is-closed (-> Atom Bool))
(= (is-closed $x) (if (is-variable $x)
False
(if (== () $x) True
(if (is-expression $x)
(and (let $head (car-atom $x) (is-closed $head))
(let $tail (cdr-atom $x) (is-closed $tail)))
True))))


;; KB
!(bind! &kb (new-space))

!(add-atom &kb (: axiom (nums 2 3)))

!(add-atom &kb (: rule1
(-> (nums $x $y)
(rule1output $x $y))))

!(add-atom &kb
(: rule
(-> (rule1output $x $y)
(-> (⍃ $x $y)
(less $x $y)))))

; !(add-atom &kb
; (: rule
; (-> (⍃ $x $y)
; (-> (rule1output $x $y)
; (less $x $y)))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; DTL Backward chaining Curried ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(: bc (-> $a Nat $a))
;; Base case
(= (bc (: $prf $ccln) $_1) (match &kb (: $prf $ccln) (: $prf $ccln)))
;; if conclusion equals (⍃ $X $Y), then return (: CPU (⍃ $X $Y))
;; if $x and $Y are fully grounded and (< $X $Y)
(= (bc (: CPU (⍃ $X $Y)) $_2)
(if (and (and (is-closed $X) (is-closed $Y)) (< $X $Y))
(: CPU (⍃ $X $Y))
(empty)))

;; Recursive step
(= (bc (: ($prfabs $prfarg) $ccln) (S $k))
(let* (((: $prfabs (-> $prms $ccln))
(bc (: $prfabs (-> $prms $ccln)) $k))
((: $prfarg $prms)
(bc (: $prfarg $prms) $k)))

(: ($prfabs $prfarg) $ccln)))


; Test
!(bc (: CPU (⍃ 2 3)) Z)
!(bc (: CPU (⍃ 4 3)) Z)

; !(pragma! eval debug)

;! ( rtrace! (bc (: $prf (less $x $y)) (S (S (S Z)))))

!(bc (: $prf (less $x $y)) (S (S (S Z))))


79 changes: 79 additions & 0 deletions tests/compiler_baseline/anti-regression/bchain_comp.metta
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
!(pragma! compile full)

(: is-variable (-> Atom Bool))
(= (is-variable $x) (== (get-metatype $x) Variable))

(: lazy-or (-> Bool Atom Bool))
(= (lazy-or False $x) $x)
(= (lazy-or True $x) True)

(: is-expression (-> Atom Bool))
(= (is-expression $x) (== (get-metatype $x) Expression))

(: is-closed (-> Atom Bool))
(= (is-closed $x) (if (is-variable $x)
False
(if (== () $x) True
(if (is-expression $x)
(and (let $head (car-atom $x) (is-closed $head))
(let $tail (cdr-atom $x) (is-closed $tail)))
True))))


;; KB
!(bind! &kb (new-space))

!(add-atom &kb (: axiom (nums 2 3)))

!(add-atom &kb (: rule1
(-> (nums $x $y)
(rule1output $x $y))))

!(add-atom &kb
(: rule
(-> (rule1output $x $y)
(-> (⍃ $x $y)
(less $x $y)))))

; !(add-atom &kb
; (: rule
; (-> (⍃ $x $y)
; (-> (rule1output $x $y)
; (less $x $y)))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; DTL Backward chaining Curried ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(: bc (-> $a Nat $a))
;; Base case
(= (bc (: $prf $ccln) $_1) (match &kb (: $prf $ccln) (: $prf $ccln)))
;; if conclusion equals (⍃ $X $Y), then return (: CPU (⍃ $X $Y))
;; if $x and $Y are fully grounded and (< $X $Y)
(= (bc (: CPU (⍃ $X $Y)) $_2)
(if (and (and (is-closed $X) (is-closed $Y)) (< $X $Y))
(: CPU (⍃ $X $Y))
(empty)))

;; Recursive step
(= (bc (: ($prfabs $prfarg) $ccln) (S $k))
(let* (((: $prfabs (-> $prms $ccln))
(bc (: $prfabs (-> $prms $ccln)) $k))
((: $prfarg $prms)
(bc (: $prfarg $prms) $k)))

(: ($prfabs $prfarg) $ccln)))


; Test
!(bc (: CPU (⍃ 2 3)) Z)
!(bc (: CPU (⍃ 4 3)) Z)

; !(pragma! eval debug)

;! ( rtrace! (bc (: $prf (less $x $y)) (S (S (S Z)))))

!(bc (: $prf (less $x $y)) (S (S (S Z))))


13 changes: 13 additions & 0 deletions tests/compiler_baseline/anti-regression/comma_is_not_special.metta
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@



;; the comma only works in match

(= (test-func2 $b) (let $a (, hello $b) $a))

!(assertEqualToResult
(test-func2 world)
((, hello world)))



Loading

0 comments on commit 8cd9211

Please sign in to comment.