aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/packfile/common_test.go
diff options
context:
space:
mode:
authorAntonio Navarro Perez <antnavper@gmail.com>2016-12-16 19:30:36 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2016-12-16 19:30:36 +0100
commit950676c36030a8796c0a69a8aae606ff1f448b03 (patch)
tree8edfd1baa31e83a396d263c2d0fed1a4d09a83dc /plumbing/format/packfile/common_test.go
parentc49d8e374443180ff68404c904ccad5d87f9073e (diff)
downloadgo-git-950676c36030a8796c0a69a8aae606ff1f448b03.tar.gz
packfile: delta selection logic (#182)
* packfile: delta selection logic - Implemented logic to assign deltas to objects * Requested changes * Improved tests and fix errors
Diffstat (limited to 'plumbing/format/packfile/common_test.go')
-rw-r--r--plumbing/format/packfile/common_test.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/plumbing/format/packfile/common_test.go b/plumbing/format/packfile/common_test.go
new file mode 100644
index 0000000..387c0d1
--- /dev/null
+++ b/plumbing/format/packfile/common_test.go
@@ -0,0 +1,36 @@
+package packfile
+
+import (
+ "testing"
+
+ "gopkg.in/src-d/go-git.v4/plumbing"
+
+ . "gopkg.in/check.v1"
+)
+
+func Test(t *testing.T) { TestingT(t) }
+
+func newObject(t plumbing.ObjectType, cont []byte) plumbing.EncodedObject {
+ o := plumbing.MemoryObject{}
+ o.SetType(t)
+ o.SetSize(int64(len(cont)))
+ o.Write(cont)
+
+ return &o
+}
+
+type piece struct {
+ val string
+ times int
+}
+
+func genBytes(elements []piece) []byte {
+ var result []byte
+ for _, e := range elements {
+ for i := 0; i < e.times; i++ {
+ result = append(result, e.val...)
+ }
+ }
+
+ return result
+}