mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-15 15:28:04 +00:00
i used this script, a little clunky but it got the job done
```bash
for file in `find . -type f -print | grep '\.go'`; do
sed '1,/^\/\/ limitations under the License.$/d' $file > $file.tmp;
result=`cat $file.tmp`
if [[ result != "" ]]; then
gofmt $file.tmp &> /dev/null;
if [[ $? == 0 ]]; then
mv $file.tmp $file && gofmt -w $file;
else
rm $file.tmp;
fi
else
rm $file.tmp;
fi
done
```
32 lines
744 B
Go
32 lines
744 B
Go
package test
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/molecula/featurebase/v2"
|
|
)
|
|
|
|
const deadlineSkew = time.Second
|
|
|
|
// CompareTransactions errors describing how the
|
|
// transactions differ (if at all). The deadlines need only be close
|
|
// (within deadlineSkew).
|
|
func CompareTransactions(t *testing.T, trns1, trns2 *pilosa.Transaction) {
|
|
t.Helper()
|
|
if err := pilosa.CompareTransactions(trns1, trns2); err != nil {
|
|
t.Errorf("%v", err)
|
|
}
|
|
if trns1 == nil || trns2 == nil {
|
|
return
|
|
}
|
|
|
|
diff := trns1.Deadline.Sub(trns2.Deadline)
|
|
|
|
if diff > deadlineSkew || diff < -deadlineSkew {
|
|
t.Errorf("Deadlines differ by %v:\n%+v\n%+v", diff, trns1, trns2)
|
|
}
|
|
if trns1.Stats != trns2.Stats {
|
|
t.Errorf("Stats differ:\n%+v\n%+v", trns1, trns2)
|
|
}
|
|
}
|