+ test "#shuffle returns correctly" do
+ orig = "actgactgactgatcgatcgatcgatcgtactg"
+ @entry.seq = "actgactgactgatcgatcgatcgatcgtactg"
+ entry_shuf = @entry.shuffle
+ assert_equal(orig, @entry.seq)
+ assert_not_equal(@entry.seq, entry_shuf.seq)
+ end
+
+ test "#shuffle! returns correctly" do
+ @entry.seq = "actgactgactgatcgatcgatcgatcgtactg"
+ assert_not_equal(@entry.seq, @entry.shuffle!.seq)
+ end
+
+ test "#+ without qual returns correctly" do
+ entry = Seq.new("test1", "at") + Seq.new("test2", "cg")
+ assert_nil(entry.seq_name)
+ assert_equal("atcg", entry.seq)
+ assert_nil(entry.type)
+ assert_nil(entry.qual)
+ end
+
+ test "#+ with qual returns correctly" do
+ entry = Seq.new("test1", "at", :dna, "II") + Seq.new("test2", "cg", :dna, "JJ")
+ assert_nil(entry.seq_name)
+ assert_equal("atcg", entry.seq)
+ assert_equal(:dna, entry.type)
+ assert_equal("IIJJ", entry.qual)
+ end
+
+ test "#<< with different types raises" do
+ @entry.seq = "atcg"
+ assert_raise(SeqError) { @entry << Seq.new("test", "atcg", :dna) }
+ end
+
+ test "#<< with missing qual in one entry raises" do
+ @entry.seq = "atcg"
+ @entry.type = :dna
+ assert_raise(SeqError) { @entry << Seq.new("test", "atcg", :dna, "IIII") }
+ @entry.qual = "IIII"
+ assert_raise(SeqError) { @entry << Seq.new("test", "atcg", :dna) }
+ end
+
+ test "#<< with nil qual in both entries dont raise" do
+ @entry.seq = "atcg"
+ assert_nothing_raised { @entry << Seq.new("test", "atcg") }
+ end
+
+ test "#<< with qual in both entries dont raise" do
+ @entry.seq = "atcg"
+ @entry.type = :dna
+ @entry.qual = "IIII"
+ assert_nothing_raised { @entry << Seq.new("test", "atcg", :dna, "IIII") }
+ end
+
+ test "#<< without qual returns correctly" do
+ @entry.seq = "atcg"
+ @entry << Seq.new("test", "ATCG")
+ assert_equal("atcgATCG", @entry.seq)
+ end
+
+ test "#<< with qual returns correctly" do
+ @entry.seq = "atcg"
+ @entry.type = :dna
+ @entry.qual = "HHHH"
+ @entry << Seq.new("test", "ATCG", :dna, "IIII")
+ assert_equal("atcgATCG", @entry.seq)
+ assert_equal("HHHHIIII", @entry.qual)
+ end
+
+ test "#[] with qual returns correctly" do
+ entry = Seq.new("test", "atcg", :dna, "FGHI")
+
+ e = entry[2]
+
+ assert_equal("test", e.seq_name)
+ assert_equal("c", e.seq)
+ assert_equal(:dna, e.type)
+ assert_equal("H", e.qual)
+ assert_equal("atcg", entry.seq)
+ assert_equal("FGHI", entry.qual)
+ end
+
+ test "#[] without qual returns correctly" do
+ entry = Seq.new("test", "atcg")
+
+ e = entry[2]
+
+ assert_equal("test", e.seq_name)
+ assert_equal("c", e.seq)
+ assert_nil(e.qual)
+ assert_equal("atcg", entry.seq)
+ end
+
+ test "[]= with qual returns correctly" do
+ entry = Seq.new("test", "atcg", :dna, "FGHI")
+
+ entry[0] = Seq.new("foo", "T", :dna, "I")
+
+ assert_equal("test", entry.seq_name)
+ assert_equal("Ttcg", entry.seq)
+ assert_equal(:dna, entry.type)
+ assert_equal("IGHI", entry.qual)
+ end
+
+ test "[]= without qual returns correctly" do
+ entry = Seq.new("test", "atcg")
+
+ entry[0] = Seq.new("foo", "T")
+
+ assert_equal("test", entry.seq_name)
+ assert_equal("Ttcg", entry.seq)
+ end
+
+ test "#subseq with start < 0 raises" do