22
33import junit .framework .TestCase ;
44
5+ import java .util .List ;
6+
57public class PlaytimeNameColorTest extends TestCase {
68
79 public void testGetMaximumColorIndex () {
@@ -12,14 +14,19 @@ public void testGetMaximumColorIndex() {
1214 double joinDates [] = {0.001 , 2.9 , 3 , 4.9 , 5 , 7.9 , 8 , 15.9 , 16 , 45.9 , 46 , 90.9 , 91 , 182.9 , 183 , 364.9 , 365 , 729 , 730.1 };
1315 double playTimes [] = {0.00001 , 2.9 , 3 , 5.9 , 6 , 11.9 , 12 , 23.9 , 24 , 47.9 , 48 , 95.9 , 96 , 191.9 , 192 , 383.9 , 384 , 767 , 768.1 };
1416
17+ List <String > colors = PlaytimeNameColor .defaultColors ;
18+
1519 for (int i = 0 ; i < playTimes .length ; i ++) {
1620 double playTime = playTimes [i ];
1721 double joinDate = joinDates [i ];
1822
19- int indexPlayTime = (int ) Math .round (PlaytimeNameColor .defaultColors .size () - 1 - Math .log (Math .ceil (maxPlaytime / playTime )) / Math .log (2 ));
20- int indexJoinDate = (int ) Math .round (PlaytimeNameColor .defaultColors .size () - 1 - Math .log (Math .ceil (maxJoinDate / joinDate )) / Math .log (2 ));
2123
22- System .out .println (playTime + " " + joinDate + " " + indexPlayTime + " " + indexJoinDate + " " + Math .max (0 , Math .min (PlaytimeNameColor .defaultColors .size () - 1 , Math .min (indexPlayTime , indexJoinDate ))));
24+ int indexPlayTime = (int ) Math .round (colors .size () - 1 - Math .log (Math .ceil (maxPlaytime / playTime )) / Math .log (2 ));
25+ int indexJoinDate = (int ) Math .round (colors .size () - 1 - Math .log (Math .ceil (maxJoinDate / joinDate )) / Math .log (2 ));
26+
27+ int resultingIndex = Math .max (0 , Math .min (colors .size () - 1 , Math .min (indexPlayTime , indexJoinDate )));
28+
29+ System .out .println (playTime + " " + joinDate + " " + indexPlayTime + " " + indexJoinDate + " " + resultingIndex );
2330 }
2431
2532 // Not a real test since there is no check if the results are correct
0 commit comments