func TestAbsorb(t *testing.T) { m1 := mat1() cmp := m1.Comp m3 := mat3() m1.Absorb(m3) assert.Eq(t, m1.Qty(), qty1+qty3) assert.Eq(t, m3.Qty(), zero) assert.Ne(t, m1.Comp, cmp) }
func TestExtractComp_Good(t *testing.T) { m := mat1() mcmp := m.Comp ecmp := mat2().Comp var qty float64 = 1.0 e, err := m.ExtractComp(qty, ecmp) assert.NoErr(t, err).Fatal() assert.Eq(t, m.Qty(), qty1-qty) assert.Eq(t, e.Qty(), qty) assert.Ne(t, m.Comp, mcmp) assert.Eq(t, e.Comp, ecmp) }