Beispiel #1
0
func TestWriteRead(t *testing.T) {

	initChainFB(t)
	modelSet, e := NewSet(hmm0, hmm1)
	fatalIf(t, e)
	t.Log(modelSet)
	fn := filepath.Join(os.TempDir(), "model_set.json")
	ju.WriteJSONFile(fn, modelSet)
	t.Logf("Wrote to temp file: %s\n", fn)
}
Beispiel #2
0
func TestWriteRead(t *testing.T) {

	root := makeTree()
	al := root.Alignment()
	fn := filepath.Join(os.TempDir(), "align.json")
	ju.WriteJSONFile(fn, al)
	t.Logf("Wrote to temp file: %s\n", fn)

	var al2 Alignment
	ju.ReadJSONFile(fn, &al2)
	t.Log(al2)

	for level := range al {
		if len(al[level]) != len(al2[level]) {
			t.Fatalf("length for level [%d] does not match - expected %d, got %d", level, len(al[level]), len(al2[level]))
		}
		for i, a := range al[level] {
			b := al2[level][i]
			if a.Start != b.Start || a.End != b.End || a.Name != b.Name {
				t.Fatalf("nodes don't match - expected %s, got %s", a, b)
			}
		}
	}
}