Skip to content

Commit fb6a7c8

Browse files
committed
Bugfix to MoveUnitsToHeader
1 parent 29eaa13 commit fb6a7c8

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

Source/Units/src/ca/uqac/lif/spreadsheet/units/MoveUnitsToHeader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ protected Object[] getValue(Object... inputs) throws InvalidNumberOfArgumentsExc
116116
}
117117
Spreadsheet table = (Spreadsheet) inputs[0];
118118
Spreadsheet out = new Spreadsheet(table.getWidth(), table.getHeight());
119-
m_mapping = new InputCell[table.getHeight()][table.getHeight()][];
119+
m_mapping = new InputCell[table.getHeight()][table.getWidth()][];
120120
m_unitRows = new int[table.getWidth()];
121121
m_lastHeaders = new String[table.getWidth()];
122122
for (int col = 0; col < table.getWidth(); col++)

Source/Units/srctest/ca/uqac/lif/spreadsheet/units/MoveUnitsToHeaderTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,19 @@ public void testOutput1()
5858
2, fp(1.3, 0.5), fp(5.8, 0.8)), out);
5959
}
6060

61+
@Test
62+
public void testOutput2()
63+
{
64+
Spreadsheet s = Spreadsheet.read(3, 2,
65+
"n", "Time", "Distance",
66+
0, null, null);
67+
MoveUnitsToHeader f = new MoveUnitsToHeader();
68+
Spreadsheet out = (Spreadsheet) f.evaluate(s)[0];
69+
assertEquals(Spreadsheet.read(3, 2,
70+
"n", "Time", "Distance",
71+
0, null, null), out);
72+
}
73+
6174
@Test
6275
public void testExplain1()
6376
{

0 commit comments

Comments
 (0)