diff options
| author | Shulhan <ms@kilabit.info> | 2021-03-14 22:37:59 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2021-03-14 22:40:05 +0700 |
| commit | e7552ad0189f761875bc1c2ca3dd716d43a01e0d (patch) | |
| tree | fd68ec29d23fb9a807a7382088020e3b17d446fd /lib/tabula | |
| parent | 882727d89c8e7f9b9761009ccdca1af8c18d0a30 (diff) | |
| download | pakakeh.go-e7552ad0189f761875bc1c2ca3dd716d43a01e0d.tar.xz | |
all: refactoring the test.Assert and test.AssertBench signature
Previously, the test.Assert and test.AssertBench functions has the
boolean parameter to print the stack trace of test in case its not equal.
Since this parameter is not mandatory and its usually always set to
"true", we remove them from function signature to simplify the call
to Assert and AssertBench.
Diffstat (limited to 'lib/tabula')
| -rw-r--r-- | lib/tabula/column_test.go | 6 | ||||
| -rw-r--r-- | lib/tabula/dataset_test.go | 44 | ||||
| -rw-r--r-- | lib/tabula/maprows_test.go | 4 | ||||
| -rw-r--r-- | lib/tabula/record_test.go | 2 | ||||
| -rw-r--r-- | lib/tabula/records_test.go | 2 | ||||
| -rw-r--r-- | lib/tabula/row_test.go | 4 | ||||
| -rw-r--r-- | lib/tabula/rows_test.go | 20 |
7 files changed, 41 insertions, 41 deletions
diff --git a/lib/tabula/column_test.go b/lib/tabula/column_test.go index 7e0ad9c4..39d68d59 100644 --- a/lib/tabula/column_test.go +++ b/lib/tabula/column_test.go @@ -31,7 +31,7 @@ func TestToFloatSlice(t *testing.T) { got := col.ToFloatSlice() expFloat := []float64{9.987654321, 8.8, 7.7, 6.6, 5.5, 4.4, 3.3} - test.Assert(t, "", expFloat, got, true) + test.Assert(t, "", expFloat, got) } func TestToStringSlice(t *testing.T) { @@ -50,7 +50,7 @@ func TestToStringSlice(t *testing.T) { got := col.ToStringSlice() - test.Assert(t, "", data, got, true) + test.Assert(t, "", data, got) } func TestDeleteRecordAt(t *testing.T) { @@ -65,5 +65,5 @@ func TestDeleteRecordAt(t *testing.T) { col.DeleteRecordAt(del) got := col.ToFloatSlice() - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } diff --git a/lib/tabula/dataset_test.go b/lib/tabula/dataset_test.go index 89e70b97..68598deb 100644 --- a/lib/tabula/dataset_test.go +++ b/lib/tabula/dataset_test.go @@ -117,13 +117,13 @@ func TestSplitRowsByNumeric(t *testing.T) { rows := splitL.GetDataAsRows() got := fmt.Sprint(rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) expIdx = []int{5, 6, 7, 8, 9} exp = DatasetStringJoinByIndex(t, datasetRows, expIdx) got = fmt.Sprint(splitR.GetDataAsRows()) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) // Split by float splitL, splitR, e = SplitRowsByNumeric(dataset, 1, 1.8) @@ -135,13 +135,13 @@ func TestSplitRowsByNumeric(t *testing.T) { exp = DatasetStringJoinByIndex(t, datasetRows, expIdx) got = fmt.Sprint(splitL.GetDataAsRows()) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) expIdx = []int{8, 9} exp = DatasetStringJoinByIndex(t, datasetRows, expIdx) got = fmt.Sprint(splitR.GetDataAsRows()) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestSplitRowsByCategorical(t *testing.T) { @@ -158,13 +158,13 @@ func TestSplitRowsByCategorical(t *testing.T) { exp := DatasetStringJoinByIndex(t, datasetRows, expIdx) got := fmt.Sprint(splitL.GetDataAsRows()) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) expIdx = []int{1, 3, 4, 6, 8, 9} exp = DatasetStringJoinByIndex(t, datasetRows, expIdx) got = fmt.Sprint(splitR.GetDataAsRows()) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestModeColumnsPushColumn(t *testing.T) { @@ -185,12 +185,12 @@ func TestModeColumnsPushColumn(t *testing.T) { got += fmt.Sprint(dataset.Columns[x].Records) } - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) // Check rows exp = "" got = fmt.Sprint(dataset.Rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestModeRowsPushColumn(t *testing.T) { @@ -202,13 +202,13 @@ func TestModeRowsPushColumn(t *testing.T) { exp := DatasetRowsJoin(t) got := fmt.Sprint(dataset.Rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) // Check columns exp = "[{int 1 0 [] []} {real 2 0 [] []} {string 0 0 [] []}]" got = fmt.Sprint(dataset.Columns) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestModeMatrixPushColumn(t *testing.T) { @@ -229,13 +229,13 @@ func TestModeMatrixPushColumn(t *testing.T) { got += fmt.Sprint(dataset.Columns[x].Records) } - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) // Check rows exp = DatasetRowsJoin(t) got = fmt.Sprint(dataset.Rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestModeRowsPushRows(t *testing.T) { @@ -249,7 +249,7 @@ func TestModeRowsPushRows(t *testing.T) { exp := DatasetRowsJoin(t) got := fmt.Sprint(dataset.Rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestModeColumnsPushRows(t *testing.T) { @@ -264,7 +264,7 @@ func TestModeColumnsPushRows(t *testing.T) { exp := "" got := fmt.Sprint(dataset.Rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) // check columns exp = DatasetColumnsJoin(t) @@ -273,7 +273,7 @@ func TestModeColumnsPushRows(t *testing.T) { got += fmt.Sprint(dataset.Columns[x].Records) } - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestModeMatrixPushRows(t *testing.T) { @@ -287,7 +287,7 @@ func TestModeMatrixPushRows(t *testing.T) { exp := DatasetRowsJoin(t) got := fmt.Sprint(dataset.Rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) // check columns exp = DatasetColumnsJoin(t) @@ -296,7 +296,7 @@ func TestModeMatrixPushRows(t *testing.T) { got += fmt.Sprint(dataset.Columns[x].Records) } - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestSelectRowsWhere(t *testing.T) { @@ -312,7 +312,7 @@ func TestSelectRowsWhere(t *testing.T) { exp := dataset.GetRow(9) got := selected.GetRow(0) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestDeleteRow(t *testing.T) { @@ -330,13 +330,13 @@ func TestDeleteRow(t *testing.T) { dataset.DeleteRow(delIdx) got := dataset.Len() - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) // Check columns len. for _, col := range dataset.Columns { got = col.Len() - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } // Check rows data. @@ -349,7 +349,7 @@ func TestDeleteRow(t *testing.T) { got := fmt.Sprint(dataset.GetRow(ridx)) ridx++ - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } // Check columns data. @@ -362,6 +362,6 @@ func TestDeleteRow(t *testing.T) { exp := fmt.Sprint(coldel) got := fmt.Sprint(dataset.Columns[x].Records) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } } diff --git a/lib/tabula/maprows_test.go b/lib/tabula/maprows_test.go index 19cd5ac8..8cd0f2d2 100644 --- a/lib/tabula/maprows_test.go +++ b/lib/tabula/maprows_test.go @@ -26,7 +26,7 @@ func TestAddRow(t *testing.T) { got := fmt.Sprint(mapRows) - test.Assert(t, "", groupByExpect, got, true) + test.Assert(t, "", groupByExpect, got) } func TestGetMinority(t *testing.T) { @@ -50,5 +50,5 @@ func TestGetMinority(t *testing.T) { exp := rowsExpect[3] got := fmt.Sprint(minRows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } diff --git a/lib/tabula/record_test.go b/lib/tabula/record_test.go index 223f9235..dd7593bc 100644 --- a/lib/tabula/record_test.go +++ b/lib/tabula/record_test.go @@ -31,5 +31,5 @@ func TestRecord(t *testing.T) { exp := fmt.Sprint(expec) got := fmt.Sprint(row) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } diff --git a/lib/tabula/records_test.go b/lib/tabula/records_test.go index 2be6f7b1..fd13d12f 100644 --- a/lib/tabula/records_test.go +++ b/lib/tabula/records_test.go @@ -25,5 +25,5 @@ func TestSortByIndex(t *testing.T) { got := fmt.Sprint(sorted) exp := fmt.Sprint(&expect) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } diff --git a/lib/tabula/row_test.go b/lib/tabula/row_test.go index e40a1cf0..7b7d3e5c 100644 --- a/lib/tabula/row_test.go +++ b/lib/tabula/row_test.go @@ -23,9 +23,9 @@ func TestClone(t *testing.T) { rowClone := row.Clone() rowClone2 := row.Clone() - test.Assert(t, "", &row, rowClone, true) + test.Assert(t, "", &row, rowClone) // changing the clone value should not change the original copy. (*rowClone2)[0].SetFloat(0) - test.Assert(t, "", &row, rowClone, true) + test.Assert(t, "", &row, rowClone) } diff --git a/lib/tabula/rows_test.go b/lib/tabula/rows_test.go index 56e1b5cc..02857523 100644 --- a/lib/tabula/rows_test.go +++ b/lib/tabula/rows_test.go @@ -21,7 +21,7 @@ func TestPushBack(t *testing.T) { exp := strings.Join(rowsExpect, "") got := fmt.Sprint(rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestPopFront(t *testing.T) { @@ -37,7 +37,7 @@ func TestPopFront(t *testing.T) { exp := rowsExpect[i] got := fmt.Sprint(row) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) if i < l { exp = strings.Join(rowsExpect[i+1:], "") @@ -46,7 +46,7 @@ func TestPopFront(t *testing.T) { } got = fmt.Sprint(rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } // empty rows @@ -55,7 +55,7 @@ func TestPopFront(t *testing.T) { exp := "<nil>" got := fmt.Sprint(row) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestPopFrontRow(t *testing.T) { @@ -71,7 +71,7 @@ func TestPopFrontRow(t *testing.T) { exp := rowsExpect[i] got := fmt.Sprint(newRows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) if i < l { exp = strings.Join(rowsExpect[i+1:], "") @@ -80,7 +80,7 @@ func TestPopFrontRow(t *testing.T) { } got = fmt.Sprint(rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } // empty rows @@ -89,7 +89,7 @@ func TestPopFrontRow(t *testing.T) { exp := "" got := fmt.Sprint(row) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestGroupByValue(t *testing.T) { @@ -102,7 +102,7 @@ func TestGroupByValue(t *testing.T) { got := fmt.Sprint(mapRows) - test.Assert(t, "", groupByExpect, got, true) + test.Assert(t, "", groupByExpect, got) } func TestRandomPick(t *testing.T) { @@ -171,8 +171,8 @@ func TestRowsDel(t *testing.T) { exp := strings.Join(rowsExpect[1:], "") got := fmt.Sprint(rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) got = fmt.Sprint(row) - test.Assert(t, "", rowsExpect[0], got, true) + test.Assert(t, "", rowsExpect[0], got) } |
