OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-matrix commits / a300ac1

Finish porting test.
Somehow overlooked this one.
a300ac1ad4395ea98953ae5daad1372245d571df
by Linas Vepštas <linasvepstas@gmail.com> · 2025-10-15T20:14:02.000Z

Changed files (1) +11 -7

tests/matrix/marginal-test.scm +11 -7
……@@ -11,6 +11,10 @@
1111
1212(use-modules (opencog matrix))
1313
14(define tvkey (Predicate "*-TruthValueKey-*"))
15(define (get-count ATOM)
16 (cog-value-ref ATOM tvkey 2))
17
1418(opencog-test-runner)
1519
1620; ---------------------------------------------------------------
……@@ -32,20 +36,20 @@
3236
3337; Add one atom, verify that the marginals are updated.
3438(mgi 'pair-inc (Concept "foo") (Concept "bar") 42)
35(test-equal "left-marg" 42.0 (cog-count (epa 'left-wildcard (Concept "bar"))))
36(test-equal "right-marg" 42.0 (cog-count (epa 'right-wildcard (Concept "foo"))))
37(test-equal "tot" 42.0 (cog-count (epa 'wild-wild)))
39(test-equal "left-marg" 42.0 (get-count (epa 'left-wildcard (Concept "bar"))))
40(test-equal "right-marg" 42.0 (get-count (epa 'right-wildcard (Concept "foo"))))
41(test-equal "tot" 42.0 (get-count (epa 'wild-wild)))
3842
3943; Add a few more atoms.
4044(mgi 'pair-inc (Concept "foo") (Concept "bar2") 0.5)
4145(mgi 'pair-inc (Concept "foo2") (Concept "bar") 1.5)
4246
4347; The original pair is untouched.
44(test-equal "pair" 42.0 (cog-count (epa 'make-pair (Concept "foo") (Concept "bar"))))
48(test-equal "pair" 42.0 (get-count (epa 'make-pair (Concept "foo") (Concept "bar"))))
4549
4650; The marginals should be accumulating.
47(test-equal "left-marg" 43.5 (cog-count (epa 'left-wildcard (Concept "bar"))))
48(test-equal "right-marg" 42.5 (cog-count (epa 'right-wildcard (Concept "foo"))))
49(test-equal "tot" 44.0 (cog-count (epa 'wild-wild)))
51(test-equal "left-marg" 43.5 (get-count (epa 'left-wildcard (Concept "bar"))))
52(test-equal "right-marg" 42.5 (get-count (epa 'right-wildcard (Concept "foo"))))
53(test-equal "tot" 44.0 (get-count (epa 'wild-wild)))
5054
5155(test-end tmarg)