aboutsummaryrefslogtreecommitdiffstats
path: root/difftree/internal/merkletrie/node_test.go
diff options
context:
space:
mode:
authorSantiago M. Mola <santi@mola.io>2016-12-14 23:12:44 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2016-12-14 23:12:44 +0100
commit0af572dd21c0aa79d13745b633ee24ba6c4d6cf1 (patch)
tree49e81e74e82d84fd88b2fc1e4b0dc7c7bfe9c40f /difftree/internal/merkletrie/node_test.go
parentdf0f38af83f972f026d7e14150f3d37b95f13484 (diff)
downloadgo-git-0af572dd21c0aa79d13745b633ee24ba6c4d6cf1.tar.gz
move plumbing from top level package to plumbing (#183)
* plumbing: rename Object -> EncodedObject. * plumbing/storer: rename ObjectStorer -> EncodedObjectStorer. * move difftree to plumbing/difftree. * move diff -> utils/diff * make Object/Tag/Blob/Tree/Commit/File depend on storer. * Object and its implementations now depend only on storer.EncodedObjectStorer, not git.Repository. * Tests are decoupled accordingly. * move Object/Commit/File/Tag/Tree to plumbing/object. * move Object/Commit/File/Tag/Tree to plumbing/object. * move checkClose to utils/ioutil. * move RevListObjects to plumbing/revlist.Objects. * move DiffTree to plumbing/difftree package. * rename files with plural nouns to singular * plumbing/object: add GetBlob/GetCommit/GetTag/GetTree.
Diffstat (limited to 'difftree/internal/merkletrie/node_test.go')
-rw-r--r--difftree/internal/merkletrie/node_test.go68
1 files changed, 0 insertions, 68 deletions
diff --git a/difftree/internal/merkletrie/node_test.go b/difftree/internal/merkletrie/node_test.go
deleted file mode 100644
index 1622952..0000000
--- a/difftree/internal/merkletrie/node_test.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package merkletrie
-
-import (
- "testing"
-
- . "gopkg.in/check.v1"
-)
-
-func Test(t *testing.T) { TestingT(t) }
-
-type NodeSuite struct{}
-
-var _ = Suite(&NodeSuite{})
-
-func (s *NodeSuite) TestHash(c *C) {
- n := newNode([]byte("the_hash"), "the_key", []*node{})
-
- expected := []byte("the_hash")
- c.Assert(expected, DeepEquals, n.Hash())
-}
-
-func (s *NodeSuite) TestKey(c *C) {
- n := newNode([]byte("the_hash"), "the_key", []*node{})
-
- expected := "the_key"
- c.Assert(expected, Equals, n.Key())
-}
-
-func (s *NodeSuite) TestNoChildren(c *C) {
- n := newNode([]byte{}, "", []*node{})
-
- expectedNumChildren := 0
- c.Assert(n.NumChildren(), Equals, expectedNumChildren)
-
- expectedChildren := []Noder{}
- c.Assert(n.Children(), DeepEquals, expectedChildren)
-}
-
-func (s *NodeSuite) TestOneChild(c *C) {
- child := newNode([]byte("child"), "child", []*node{})
- parent := newNode([]byte("parent"), "parent", []*node{child})
-
- expectedNumChildren := 1
- c.Assert(parent.NumChildren(), Equals, expectedNumChildren)
-
- expectedChildren := []Noder{Noder(child)}
- c.Assert(parent.Children(), DeepEquals, expectedChildren)
-}
-
-func (s *NodeSuite) TestManyChildren(c *C) {
- child0 := newNode([]byte("child0"), "child0", []*node{})
- child1 := newNode([]byte("child1"), "child1", []*node{})
- child2 := newNode([]byte("child2"), "child2", []*node{})
- child3 := newNode([]byte("child3"), "child3", []*node{})
- // children are added unsorted.
- parent := newNode([]byte("parent"), "parent", []*node{child1, child3, child0, child2})
-
- expectedNumChildren := 4
- c.Assert(parent.NumChildren(), Equals, expectedNumChildren)
-
- expectedChildren := []Noder{ // sorted alphabetically by key
- Noder(child3),
- Noder(child2),
- Noder(child1),
- Noder(child0),
- }
- c.Assert(parent.Children(), DeepEquals, expectedChildren)
-}