2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-29 13:22:43 +00:00
restic/backend/ids_test.go

59 lines
1.9 KiB
Go
Raw Normal View History

2015-07-26 20:04:03 +00:00
package backend_test
import (
"reflect"
"testing"
"github.com/restic/restic/backend"
2016-01-26 20:52:02 +00:00
. "github.com/restic/restic/test"
2015-07-26 20:04:03 +00:00
)
var uniqTests = []struct {
before, after backend.IDs
}{
{
backend.IDs{
2016-01-26 20:52:02 +00:00
ParseID("7bb086db0d06285d831485da8031281e28336a56baa313539eaea1c73a2a1a40"),
ParseID("1285b30394f3b74693cc29a758d9624996ae643157776fce8154aabd2f01515f"),
ParseID("7bb086db0d06285d831485da8031281e28336a56baa313539eaea1c73a2a1a40"),
2015-07-26 20:04:03 +00:00
},
backend.IDs{
2016-01-26 20:52:02 +00:00
ParseID("7bb086db0d06285d831485da8031281e28336a56baa313539eaea1c73a2a1a40"),
ParseID("1285b30394f3b74693cc29a758d9624996ae643157776fce8154aabd2f01515f"),
2015-07-26 20:04:03 +00:00
},
},
{
backend.IDs{
2016-01-26 20:52:02 +00:00
ParseID("1285b30394f3b74693cc29a758d9624996ae643157776fce8154aabd2f01515f"),
ParseID("7bb086db0d06285d831485da8031281e28336a56baa313539eaea1c73a2a1a40"),
ParseID("7bb086db0d06285d831485da8031281e28336a56baa313539eaea1c73a2a1a40"),
2015-07-26 20:04:03 +00:00
},
backend.IDs{
2016-01-26 20:52:02 +00:00
ParseID("1285b30394f3b74693cc29a758d9624996ae643157776fce8154aabd2f01515f"),
ParseID("7bb086db0d06285d831485da8031281e28336a56baa313539eaea1c73a2a1a40"),
2015-07-26 20:04:03 +00:00
},
},
{
backend.IDs{
2016-01-26 20:52:02 +00:00
ParseID("1285b30394f3b74693cc29a758d9624996ae643157776fce8154aabd2f01515f"),
ParseID("f658198b405d7e80db5ace1980d125c8da62f636b586c46bf81dfb856a49d0c8"),
ParseID("7bb086db0d06285d831485da8031281e28336a56baa313539eaea1c73a2a1a40"),
ParseID("7bb086db0d06285d831485da8031281e28336a56baa313539eaea1c73a2a1a40"),
2015-07-26 20:04:03 +00:00
},
backend.IDs{
2016-01-26 20:52:02 +00:00
ParseID("1285b30394f3b74693cc29a758d9624996ae643157776fce8154aabd2f01515f"),
ParseID("f658198b405d7e80db5ace1980d125c8da62f636b586c46bf81dfb856a49d0c8"),
ParseID("7bb086db0d06285d831485da8031281e28336a56baa313539eaea1c73a2a1a40"),
2015-07-26 20:04:03 +00:00
},
},
}
func TestUniqIDs(t *testing.T) {
for i, test := range uniqTests {
uniq := test.before.Uniq()
if !reflect.DeepEqual(uniq, test.after) {
t.Errorf("uniqIDs() test %v failed\n wanted: %v\n got: %v", i, test.after, uniq)
}
}
}