Skip to content

Commit

Permalink
Update more tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Sep 19, 2024
1 parent 1a20e0e commit 555f5ee
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/optimization/table_data_merge_columns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,17 @@ func TestTableData_UpdateInMemoryColumnsFromDestination(t *testing.T) {
assert.False(t, isOk, nonExistentTableCol)
}
}
{
// In-memory column was invalid, but the destination column is valid
tableDataCols.AddColumn(columns.NewColumn("invalid_test", typing.Invalid))
assert.NoError(t, tableData.MergeColumnsFromDestination(columns.NewColumn("invalid_test", typing.String)))

tableDataCols.AddColumn(columns.NewColumn("name", typing.String))
tableDataCols.AddColumn(columns.NewColumn("prev_invalid", typing.Invalid))
invalidCol, isOk := tableData.inMemoryColumns.GetColumn("invalid_test")
assert.True(t, isOk)
assert.Equal(t, typing.String.Kind, invalidCol.KindDetails.Kind)
}

tableDataCols.AddColumn(columns.NewColumn("name", typing.String))
// Casting these as STRING so tableColumn via this f(x) will set it correctly.
tableDataCols.AddColumn(columns.NewColumn("ext_date", typing.String))
tableDataCols.AddColumn(columns.NewColumn("ext_time", typing.String))
Expand All @@ -96,12 +103,6 @@ func TestTableData_UpdateInMemoryColumnsFromDestination(t *testing.T) {
tableDataCols.AddColumn(columns.NewColumn("ext_dec_filled", extDecimalType))
tableDataCols.AddColumn(columns.NewColumn(strCol, typing.String))

// Testing to make sure we're copying the kindDetails over.
assert.NoError(t, tableData.MergeColumnsFromDestination(columns.NewColumn("prev_invalid", typing.String)))
prevInvalidCol, isOk := tableData.inMemoryColumns.GetColumn("prev_invalid")
assert.True(t, isOk)
assert.Equal(t, typing.String, prevInvalidCol.KindDetails)

// Testing extTimeDetails
for _, extTimeDetailsCol := range []string{"ext_date", "ext_time", "ext_datetime"} {
col, isOk := tableData.inMemoryColumns.GetColumn(extTimeDetailsCol)
Expand Down Expand Up @@ -165,7 +166,6 @@ func TestTableData_UpdateInMemoryColumnsFromDestination(t *testing.T) {
// String (precision being copied over)
tableDataCols := &columns.Columns{}
tableData := &TableData{inMemoryColumns: tableDataCols}

tableDataCols.AddColumn(columns.NewColumn(strCol, typing.String))
assert.NoError(t, tableData.MergeColumnsFromDestination(columns.NewColumn(strCol,
typing.KindDetails{
Expand Down

0 comments on commit 555f5ee

Please sign in to comment.