@@ -36,4 +36,74 @@ public void parseInto() {
3636 Assert .assertEquals (people [0 ].name , "Person1" );
3737 Assert .assertEquals (people [0 ].age , 30 );
3838 }
39+
40+ @ Test
41+ public void testGetMaxFloat () {
42+ Table table = new Table ();
43+ table .addColumn ("col1" , Table .FLOAT );
44+ table .addColumn ("col2" , Table .FLOAT );
45+ table .addColumn ("col3" , Table .FLOAT );
46+
47+ //Normal case with positive values
48+ TableRow row1 = table .addRow ();
49+ row1 .setFloat ("col1" , 5.5f );
50+ row1 .setFloat ("col2" , 10.2f );
51+ row1 .setFloat ("col3" , 3.7f );
52+
53+ TableRow row2 = table .addRow ();
54+ row2 .setFloat ("col1" , 15.8f );
55+ row2 .setFloat ("col2" , 2.1f );
56+ row2 .setFloat ("col3" , 8.9f );
57+
58+ assertEquals (15.8f , table .getMaxFloat (), 0.001f );
59+
60+ //Table with negative values
61+ Table table2 = new Table ();
62+ table2 .addColumn ("col1" , Table .FLOAT );
63+ TableRow row3 = table2 .addRow ();
64+ row3 .setFloat ("col1" , -5.5f );
65+ TableRow row4 = table2 .addRow ();
66+ row4 .setFloat ("col1" , -2.3f );
67+
68+ assertEquals (-2.3f , table2 .getMaxFloat (), 0.001f );
69+
70+ //Table with missing values (NaN)
71+ Table table3 = new Table ();
72+ table3 .addColumn ("col1" , Table .FLOAT );
73+ table3 .addColumn ("col2" , Table .FLOAT );
74+
75+ TableRow row5 = table3 .addRow ();
76+ row5 .setFloat ("col1" , Float .NaN );
77+ row5 .setFloat ("col2" , 7.5f );
78+
79+ TableRow row6 = table3 .addRow ();
80+ row6 .setFloat ("col1" , 12.3f );
81+ row6 .setFloat ("col2" , Float .NaN );
82+
83+ assertEquals (12.3f , table3 .getMaxFloat (), 0.001f );
84+
85+ //Table with all missing values
86+ Table table4 = new Table ();
87+ table4 .addColumn ("col1" , Table .FLOAT );
88+ TableRow row7 = table4 .addRow ();
89+ row7 .setFloat ("col1" , Float .NaN );
90+ TableRow row8 = table4 .addRow ();
91+ row8 .setFloat ("col1" , Float .NaN );
92+
93+ assertTrue (Float .isNaN (table4 .getMaxFloat ()));
94+
95+ //Empty table
96+ Table table5 = new Table ();
97+ table5 .addColumn ("col1" , Table .FLOAT );
98+
99+ assertTrue (Float .isNaN (table5 .getMaxFloat ()));
100+
101+ //Single value
102+ Table table6 = new Table ();
103+ table6 .addColumn ("col1" , Table .FLOAT );
104+ TableRow row9 = table6 .addRow ();
105+ row9 .setFloat ("col1" , 42.0f );
106+
107+ assertEquals (42.0f , table6 .getMaxFloat (), 0.001f );
108+ }
39109}
0 commit comments