import scas._
import Implicits.{QQ, coef2polynomial, ring2scalar}
implicit val r = Polynomial(QQ, 'x)
implicit val vector = Module("e", 2, r)
val Array(x) = r.generators
val e = vector.generators
assert (vector(1, x) >< e(0) + x * e(1))
assert (2 * e(0) >< e(0) :* 2)
assert (frac(1, 2) * e(0) >< e(0) :* frac(1, 2))
assert (x * e(0) >< e(0) :* x)
assert (2 * x * e(0) >< e(0) :* (2 * x))
assert (frac(1, 2) * x * e(0) >< e(0) :* (frac(1, 2) * x))
assert (e(0) + e(1) >< e(0) + e(1))
assert ((2 * e(0) + e(1)).toCode(0) == "2*e(0)+e(1)")
assert ((frac(1, 2) * e(0) + e(1)).value.deep.toString == "Array(frac(1, 2), 1)")
assert (vector.toString == "QQ[x]^2")