Skip to content

Commit

Permalink
Fix formatting (#1281)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccleva authored Jan 10, 2025
1 parent 074fb19 commit acbae39
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions core/src/test/java/tech/tablesaw/api/TableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ static void readTables() {
.columnTypes(BUSH_COLUMN_TYPES));
ColumnType[] types = {LOCAL_DATE, SHORT, STRING};
bushMinimized = Table.read().csv(CsvReadOptions.builder("../data/bush.csv").columnTypes(types));
missingValues = Table.read().csv(CsvReadOptions.builder("../data/missing_values.csv")
.missingValueIndicator("-"));
missingValues =
Table.read()
.csv(CsvReadOptions.builder("../data/missing_values.csv").missingValueIndicator("-"));
}

@BeforeEach
Expand Down Expand Up @@ -922,33 +923,40 @@ public void testToStringColumnsWithVaryingSizes() {

@Test
void testCompareRowsIdentical() {
for(int i = 0; i < missingValues.rowCount(); i++) {
assertTrue(Table.compareRows(i, missingValues, missingValues), "Row " + i + " is not equal to itself");
}
for (int i = 0; i < missingValues.rowCount(); i++) {
assertTrue(
Table.compareRows(i, missingValues, missingValues),
"Row " + i + " is not equal to itself");
}
}

@Test
void testCompareRowsDifferent() {
Table differentTable = missingValues.copy().sortDescendingOn("Sales");
for(int i = 0; i < missingValues.rowCount(); i++) {
assertFalse(Table.compareRows(i, missingValues, differentTable), "Row " + i + " is equal to a different row");
}
Table differentTable = missingValues.copy().sortDescendingOn("Sales");
for (int i = 0; i < missingValues.rowCount(); i++) {
assertFalse(
Table.compareRows(i, missingValues, differentTable),
"Row " + i + " is equal to a different row");
}
}

@Test
void testCompareRowsDifferentColumns() {
Table differentTable = missingValues.copy().removeColumns("Sales");
for(int i = 0; i < missingValues.rowCount(); i++) {
assertFalse(Table.compareRows(i, missingValues, differentTable), "Row " + i + " is equal to a row with less columns");
}
Table differentTable = missingValues.copy().removeColumns("Sales");
for (int i = 0; i < missingValues.rowCount(); i++) {
assertFalse(
Table.compareRows(i, missingValues, differentTable),
"Row " + i + " is equal to a row with less columns");
}
}

@Test
void testCompareRowsOutOfBound() {
Table differentTable = missingValues.copy().dropRows(0);
int lastRowNumber = missingValues.rowCount() - 1;
assertThrows(IndexOutOfBoundsException.class,
() -> Table.compareRows(lastRowNumber, missingValues, differentTable),
"Row outside range does not throw exception");
Table differentTable = missingValues.copy().dropRows(0);
int lastRowNumber = missingValues.rowCount() - 1;
assertThrows(
IndexOutOfBoundsException.class,
() -> Table.compareRows(lastRowNumber, missingValues, differentTable),
"Row outside range does not throw exception");
}
}

0 comments on commit acbae39

Please sign in to comment.