Skip to content

Commit

Permalink
Merge pull request #350 from blacob/main
Browse files Browse the repository at this point in the history
add field type test
  • Loading branch information
dcbw committed Jun 30, 2023
2 parents 2fcc81c + 646ad13 commit 24370f6
Showing 1 changed file with 37 additions and 8 deletions.
45 changes: 37 additions & 8 deletions modelgen/table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -686,19 +686,48 @@ func TestStructName(t *testing.T) {
}
}

/*
TODO: Write Test
func TestFieldType(t *testing.T) {
singleValueSet := `{
"type": {
"key": {
"type": "string"
},
"min": 0
}
}`
singleValueSetSchema := ovsdb.ColumnSchema{}
err := json.Unmarshal([]byte(singleValueSet), &singleValueSetSchema)
require.NoError(t, err)

multipleValueSet := `{
"type": {
"key": {
"type": "string"
},
"min": 0,
"max": 2
}
}`
multipleValueSetSchema := ovsdb.ColumnSchema{}
err = json.Unmarshal([]byte(multipleValueSet), &multipleValueSetSchema)
require.NoError(t, err)

tests := []struct {
name string
in *ovsdb.ColumnSchema
out string
tableName string
columnName string
in *ovsdb.ColumnSchema
out string
}{
{"t1", "c1", &singleValueSetSchema, "*string"},
{"t1", "c2", &multipleValueSetSchema, "[2]string"},
}
if got := FieldType(tt.args.column); got != tt.want {
t.Errorf("FieldType() = %v, want %v", got, tt.want)

for _, tt := range tests {
if got := FieldType(tt.tableName, tt.columnName, tt.in); got != tt.out {
t.Errorf("FieldType() = %v, want %v", got, tt.out)
}
}
}
*/

func TestAtomicType(t *testing.T) {
tests := []struct {
Expand Down

0 comments on commit 24370f6

Please sign in to comment.