Drop duration type

This commit is contained in:
Asdine El Hrychy
2020-09-28 22:32:06 +04:00
parent e146328321
commit dfdbc16b18
24 changed files with 11 additions and 312 deletions

View File

@@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"testing"
"time"
"github.com/genjidb/genji/document"
"github.com/stretchr/testify/require"
@@ -34,14 +33,6 @@ func jsonToBoolean(t testing.TB, x string) document.Value {
return document.NewBoolValue(b)
}
func jsonToDuration(t testing.TB, x string) document.Value {
var d time.Duration
err := json.Unmarshal([]byte(x), &d)
require.NoError(t, err)
return document.NewDurationValue(d)
}
func toText(t testing.TB, x string) document.Value {
return document.NewTextValue(x)
}
@@ -127,24 +118,6 @@ func TestCompare(t *testing.T) {
{"<=", "1", "2", true, jsonToDouble},
{"<=", "2", "2", true, jsonToDouble},
// duration
{"=", "2", "1", false, jsonToDuration},
{"=", "2", "2", true, jsonToDuration},
{"!=", "2", "1", true, jsonToDuration},
{"!=", "2", "2", false, jsonToDuration},
{">", "2", "1", true, jsonToDuration},
{">", "1", "2", false, jsonToDuration},
{">", "2", "2", false, jsonToDuration},
{">=", "2", "1", true, jsonToDuration},
{">=", "1", "2", false, jsonToDuration},
{">=", "2", "2", true, jsonToDuration},
{"<", "2", "1", false, jsonToDuration},
{"<", "1", "2", true, jsonToDuration},
{"<", "2", "2", false, jsonToDuration},
{"<=", "2", "1", false, jsonToDuration},
{"<=", "1", "2", true, jsonToDuration},
{"<=", "2", "2", true, jsonToDuration},
// text
{"=", "b", "a", false, toText},
{"=", "b", "b", true, toText},