Add sats symbol option, add countdown in blocks, add decimal point for market cap, add hostname to setup screen

This commit is contained in:
Djuri 2024-03-10 12:35:20 +01:00
parent e4a39de5fc
commit c49b8edcb8
15 changed files with 822 additions and 321 deletions

View file

@ -10,7 +10,7 @@ void tearDown(void) {
}
void test_CorrectSatsPerDollarConversion(void) {
std::array<std::string, NUM_SCREENS> output = parseSatsPerCurrency(37253, '$');
std::array<std::string, NUM_SCREENS> output = parseSatsPerCurrency(37253, '$', false);
TEST_ASSERT_EQUAL_STRING("MSCW/TIME", output[0].c_str());
TEST_ASSERT_EQUAL_STRING("2", output[NUM_SCREENS-4].c_str());
TEST_ASSERT_EQUAL_STRING("6", output[NUM_SCREENS-3].c_str());
@ -40,13 +40,49 @@ void test_PriceOf100kusd(void) {
void test_PriceOf1MillionUsd(void) {
std::array<std::string, NUM_SCREENS> output = parsePriceData(1000000, '$');
TEST_ASSERT_EQUAL_STRING("BTC/USD", output[0].c_str());
for (int i = 1; i <= NUM_SCREENS-3; i++) {
TEST_ASSERT_EQUAL_STRING(" ", output[i].c_str());
}
TEST_ASSERT_EQUAL_STRING("1", output[NUM_SCREENS-2].c_str());
TEST_ASSERT_EQUAL_STRING("1", output[NUM_SCREENS-5].c_str());
TEST_ASSERT_EQUAL_STRING(".", output[NUM_SCREENS-4].c_str());
TEST_ASSERT_EQUAL_STRING("0", output[NUM_SCREENS-3].c_str());
TEST_ASSERT_EQUAL_STRING("0", output[NUM_SCREENS-2].c_str());
TEST_ASSERT_EQUAL_STRING("M", output[NUM_SCREENS-1].c_str());
}
void test_McapLowerUsd(void) {
std::array<std::string, NUM_SCREENS> output = parseMarketCap(810000, 26000, '$', true);
TEST_ASSERT_EQUAL_STRING("USD/MCAP", output[0].c_str());
// TEST_ASSERT_EQUAL_STRING("$", output[NUM_SCREENS-6].c_str());
TEST_ASSERT_EQUAL_STRING("$", output[NUM_SCREENS-5].c_str());
TEST_ASSERT_EQUAL_STRING("5", output[NUM_SCREENS-4].c_str());
TEST_ASSERT_EQUAL_STRING("0", output[NUM_SCREENS-3].c_str());
TEST_ASSERT_EQUAL_STRING("7", output[NUM_SCREENS-2].c_str());
TEST_ASSERT_EQUAL_STRING("B", output[NUM_SCREENS-1].c_str());
}
void test_Mcap1TrillionUsd(void) {
std::array<std::string, NUM_SCREENS> output = parseMarketCap(831000, 52000, '$', true);
TEST_ASSERT_EQUAL_STRING("USD/MCAP", output[0].c_str());
TEST_ASSERT_EQUAL_STRING("$", output[NUM_SCREENS-6].c_str());
TEST_ASSERT_EQUAL_STRING("1", output[NUM_SCREENS-5].c_str());
TEST_ASSERT_EQUAL_STRING(".", output[NUM_SCREENS-4].c_str());
TEST_ASSERT_EQUAL_STRING("0", output[NUM_SCREENS-3].c_str());
TEST_ASSERT_EQUAL_STRING("2", output[NUM_SCREENS-2].c_str());
TEST_ASSERT_EQUAL_STRING("T", output[NUM_SCREENS-1].c_str());
}
void test_Mcap1TrillionEur(void) {
std::array<std::string, NUM_SCREENS> output = parseMarketCap(831000, 52000, '[', true);
TEST_ASSERT_EQUAL_STRING("EUR/MCAP", output[0].c_str());
TEST_ASSERT_EQUAL_STRING("[", output[NUM_SCREENS-6].c_str());
TEST_ASSERT_EQUAL_STRING("1", output[NUM_SCREENS-5].c_str());
TEST_ASSERT_EQUAL_STRING(".", output[NUM_SCREENS-4].c_str());
TEST_ASSERT_EQUAL_STRING("0", output[NUM_SCREENS-3].c_str());
TEST_ASSERT_EQUAL_STRING("2", output[NUM_SCREENS-2].c_str());
TEST_ASSERT_EQUAL_STRING("T", output[NUM_SCREENS-1].c_str());
}
// not needed when using generate_test_runner.rb
int runUnityTests(void) {
UNITY_BEGIN();
@ -54,7 +90,10 @@ int runUnityTests(void) {
RUN_TEST(test_SixCharacterBlockHeight);
RUN_TEST(test_SevenCharacterBlockHeight);
RUN_TEST(test_PriceOf100kusd);
RUN_TEST(test_PriceOf1MillionUsd);
RUN_TEST(test_McapLowerUsd);
RUN_TEST(test_Mcap1TrillionUsd);
RUN_TEST(test_Mcap1TrillionEur);
//RUN_TEST(test_Mcap1MillionEur);
return UNITY_END();
}