19995: Add -max-frequency filter.
[lightning.git] / diff_test.go
1 // Copyright (C) The Lightning Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 package lightning
6
7 import (
8         "bytes"
9         "io/ioutil"
10         "os"
11
12         "gopkg.in/check.v1"
13 )
14
15 type diffSuite struct{}
16
17 var _ = check.Suite(&diffSuite{})
18
19 func (s *diffSuite) TestDiff(c *check.C) {
20         tempdir, err := ioutil.TempDir("", "")
21         c.Assert(err, check.IsNil)
22         defer os.RemoveAll(tempdir)
23
24         err = ioutil.WriteFile(tempdir+"/f1.fa", []byte(">f1\nactgactCacgtacgt\nactgactgacgAAcgt\n"), 0700)
25         c.Assert(err, check.IsNil)
26         err = ioutil.WriteFile(tempdir+"/f2.fa", []byte(">f2\nactgactGacgtacgt\nactgactgacgTTcgtA\n"), 0700)
27         c.Assert(err, check.IsNil)
28
29         var output bytes.Buffer
30         exited := (&diffFasta{}).RunCommand("diff-fasta", []string{"-sequence", "chr2", "-offset", "1000", tempdir + "/f1.fa", tempdir + "/f2.fa"}, nil, &output, os.Stderr)
31         c.Check(exited, check.Equals, 0)
32         c.Check("\n"+output.String(), check.Equals, `
33 chr2:g.1008C>G  chr2    1008    C       G       false
34 chr2:g.1028A>T  chr2    1028    A       T       false
35 chr2:g.1029A>T  chr2    1029    A       T       false
36 chr2:g.1032_1033insA    chr2    1033            A       false
37 `)
38 }