package com.philliphsu.bottomsheetpickers.view.numberpad;

import java.util.ArrayList;
import java.util.List;

import static com.philliphsu.bottomsheetpickers.view.numberpad.AmPmStates.UNSPECIFIED;
import static com.philliphsu.bottomsheetpickers.view.numberpad.ButtonTextModel.text;

/*
 * TODO
 * #########
 * 24 hour
 * #########
 * 00-23 : 00-59 => 24 * 60 = 1440 tests
 * 0-9 : 00-59   => 10 * 60 =  600 tests
 *
 * #########
 * 12 hour
 * #########
 * 1-9 : 00-59 [am/pm]  => 9 * 60 * 2 = 1080 tests
 * 10-12 : 00-59 [am/pm] => 3 * 60 * 2 = 360 tests
 */
final class TestSuite {
    static final List<TestCase> MODE_12HR_TESTS_1_TO_9 = new ArrayList<>(9);
    static final List<TestCase> MODE_24HR_TESTS_0_TO_9 = new ArrayList<>(10);

    static {
        build_Mode12Hr_Tests_1_to_9();
        build_Mode24Hr_Tests_0_to_9();
    }

    private static void build_Mode12Hr_Tests_1_to_9() {
        for (int i = 1; i <= 9; i++) {
            MODE_12HR_TESTS_1_TO_9.add(new TestCase.Builder(array(i), UNSPECIFIED)
                    .numberKeysEnabled(0, 6 /* 1[0-2]:... or i:[0-5]... */)
                    .backspaceEnabled(true)
                    .headerDisplayFocused(true)
                    .altKeysEnabled(true)
                    .okButtonEnabled(false)
                    .timeDisplay(text(i))
                    .build());
        }
    }

    private static void build_Mode24Hr_Tests_0_to_9() {
        for (int i = 0; i <= 9; i++) {
            TestCase.Builder builder = new TestCase.Builder(array(i), UNSPECIFIED)
                    .backspaceEnabled(true)
                    .headerDisplayFocused(true)
                    .altKeysEnabled(true)
                    .okButtonEnabled(false)
                    .timeDisplay(text(i));
            if (i <= 1) {
                builder.numberKeysEnabled(0, 10 /* i[0-9]:... or i:[0-5]... */);
            } else {
                builder.numberKeysEnabled(0, 6 /* 2[0-3]:... or i:[0-5]... */);
            }
            MODE_24HR_TESTS_0_TO_9.add(builder.build());
        }
    }

    private static int[] array(int... a) {
        return a == null ? new int[0] : a;
    }
}

@@ -731,16 +731,96 @@
 t%3C%3E(10);
+%0A    static final List%3CTestCase%3E MODE_12HR_TESTS_10_TO_95 = new ArrayList%3C%3E(54);
 %0A%0A    st
@@ -900,24 +900,65 @@
 s_0_to_9();%0A
+        build_Mode12Hr_Tests_10_to_95();%0A
     %7D%0A%0A    p
@@ -2161,32 +2161,803 @@
        %7D%0A    %7D%0A%0A
+    private static void build_Mode12Hr_Tests_10_to_95() %7B%0A        for (int i = 10; i %3C= 95; i++) %7B%0A            if (i %25 10 %3E 5) continue;%0A            TestCase test = new TestCase.Builder(array(i / 10, i %25 10), UNSPECIFIED)%0A                    .numberKeysEnabled(0, 10)%0A                    .backspaceEnabled(true)%0A                    .headerDisplayFocused(true)%0A                    .altKeysEnabled(i %3E= 10 && i %3C= 12)%0A                    .okButtonEnabled(false)%0A                    .timeDisplay(String.format(%22%25d%22, i) /* TODO: Pull formatting logic from%0A                    Presenter impl. into its own class. Then format the current sequence of%0A                    digits. */)%0A                    .build();%0A            MODE_12HR_TESTS_10_TO_95.add(test);%0A        %7D%0A    %7D%0A%0A
     private stat

Build tests for input 10 - 95 in 12-hour mode.