mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-29 19:39:52 -05:00
8e64e636aa
Introduce photo-dedup-by-date This program deduplicates photos by the date they were taken. It considers two photos a group if they were separated by less than 5 seconds.
41 lines
727 B
Go
41 lines
727 B
Go
package random
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/attic-labs/testify/assert"
|
|
)
|
|
|
|
type testReader byte
|
|
|
|
func (r *testReader) Read(dest []byte) (int, error) {
|
|
for i := 0; i < len(dest); i++ {
|
|
dest[i] = byte(*r)
|
|
}
|
|
return len(dest), nil
|
|
}
|
|
|
|
func TestBasic(t *testing.T) {
|
|
assert := assert.New(t)
|
|
|
|
func() {
|
|
var r testReader
|
|
oldReader := reader
|
|
reader = &r
|
|
defer func() {
|
|
reader = oldReader
|
|
}()
|
|
|
|
r = testReader(byte(0x00))
|
|
assert.Equal("00000000000000000000000000000000", Id())
|
|
r = testReader(byte(0x01))
|
|
assert.Equal("01010101010101010101010101010101", Id())
|
|
r = testReader(byte(0xFF))
|
|
assert.Equal("ffffffffffffffffffffffffffffffff", Id())
|
|
}()
|
|
|
|
one := Id()
|
|
two := Id()
|
|
assert.NotEqual(one, two)
|
|
}
|