Example #1
0
func (s *S) TestBaseOrientationOf(c *check.C) {
	for _, t := range orientationTests {
		ori, ref := feat.BaseOrientationOf(t.f)
		c.Check(ori, check.Equals, t.ori)
		c.Check(ref, check.Equals, t.ref)
	}

	// Check that we find the same reference where possible.
	_, refGeneA := feat.BaseOrientationOf(geneA)
	_, refGeneB := feat.BaseOrientationOf(geneB)
	c.Check(refGeneA, check.Equals, refGeneB)

	// Check that unorientable features return different reference features.
	_, refOpA := feat.BaseOrientationOf(opA)
	_, refOpB := feat.BaseOrientationOf(opB)
	c.Check(refOpA, check.Not(check.Equals), refOpB)
	_, refChrom1 := feat.BaseOrientationOf(chrom1)
	_, refChrom2 := feat.BaseOrientationOf(chrom2)
	c.Check(refChrom1, check.Not(check.Equals), refChrom2)

	// Check we detect cycles.
	var cycle ori
	cycle.orient = feat.Forward
	cycle.loc = &cycle
	c.Check(func() { feat.BaseOrientationOf(cycle) }, check.Panics, "feat: feature chain too long")
}
Example #2
0
func (s *S) TestBaseOrientationOf(c *check.C) {
	for _, t := range orientationTests {
		ori, ref := feat.BaseOrientationOf(t.f)
		c.Check(ori, check.Equals, t.baseOri)
		c.Check(ref, check.Equals, t.ref)
	}

	// Check that we find the same reference where possible.
	_, ref1 := feat.BaseOrientationOf(orfA)
	_, ref2 := feat.BaseOrientationOf(antiA)
	c.Check(ref1, check.Equals, ref2)
	_, ref1 = feat.BaseOrientationOf(orfA)
	_, ref2 = feat.BaseOrientationOf(orfB)
	c.Check(ref1, check.Equals, ref2)
	_, ref1 = feat.BaseOrientationOf(freeOri1)
	_, ref2 = feat.BaseOrientationOf(freeOri2)
	c.Check(ref1, check.Not(check.Equals), ref2)

	// Check we detect cycles.
	var cycle ori
	cycle.orient = feat.Forward
	cycle.loc = &cycle
	c.Check(func() { feat.BaseOrientationOf(cycle) }, check.Panics, "feat: feature chain too long")
}