close Warning: Can't synchronize with repository "(default)" (The repository directory has changed, you should resynchronize the repository with: trac-admin $ENV repository resync '(default)'). Look in the Trac log for more information.

Changeset 2327


Ignore:
Timestamp:
2015-06-18T19:50:23-07:00 (10 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/5am-monom.lisp

    r2326 r2327  
    8585      (r-depends-p m 3))))
    8686 
     87(def-fixture term-context ()
     88  (let ((z (make-unstance 'term  :dimension 3))
     89        (m (make-instance 'term  :dimension 3 :exponents '(1 2 3)))
     90        (n (make-instance 'term  :dimension 3 :exponents '(4 5 6)))
     91        (m*n (make-instance 'term  :dimension 3 :exponents '(5 7 9)))
     92        (n/m (make-instance 'term  :dimension 3 :exponents '(3 3 3)))
     93        (m-tensor-n (make-instance 'term  :exponents '(1 2 3 4 5 6))))
     94    (&body)))
     95
     96(test monom-basics
     97  "Monom basics"
     98  (with-fixture term-context ()
     99    (is (= (r-dimension m) 3))
     100    (is (= (r-elt m 2) 3))
     101    (is (= (r-total-degree m) 6))
     102    (is (= (r-sugar m) 6))
     103    (is (equalp  (r->list z) '(0 0 0)) "Trivial monomial is a vector of 0's")
     104    (is (r-equalp (r* m n) m*n))
     105    (is (r-equalp (r/ n m) n/m))
     106    (is (r-equalp (r-tensor-product m n) m-tensor-n))
     107    (signals
     108        (error "INITIAL-EXPONENTS must have length DIMENSION")
     109      (make-instance 'monom  :dimension 3 :exponents '(1 2 3 4 5 6)))
     110    (is-true (r-divides-p m n))
     111    (is-false (r-divides-p n m))
     112    (is (r-equalp (r-gcd m n) m))
     113    (is (r-equalp (r-lcm m n) n))
     114    (is-true (r-depends-p m 0))
     115    (signals
     116        (error "Index out of bounds")
     117      (r-depends-p m 3))))
     118
     119
     120
    87121(run! 'monom-suite)
    88122(format t "All tests done!~%")
Note: See TracChangeset for help on using the changeset viewer.