feat: Add LNBits multi currency price integration
This commit is contained in:
parent
3e54343da8
commit
19c877a254
12 changed files with 526 additions and 155 deletions
|
@ -36,12 +36,15 @@ void test_CorrectSatsPerDollarConversion(void)
|
|||
void test_SatsPerDollarAfter1B(void)
|
||||
{
|
||||
std::array<std::string, NUM_SCREENS> output = parseSatsPerCurrency(120000000, CURRENCY_USD, false);
|
||||
TEST_ASSERT_EQUAL_STRING("SATS/USD", output[0].c_str());
|
||||
TEST_ASSERT_EQUAL_STRING("0", output[NUM_SCREENS - 5].c_str());
|
||||
TEST_ASSERT_EQUAL_STRING(".", output[NUM_SCREENS - 4].c_str());
|
||||
TEST_ASSERT_EQUAL_STRING("8", output[NUM_SCREENS - 3].c_str());
|
||||
TEST_ASSERT_EQUAL_STRING("3", output[NUM_SCREENS - 2].c_str());
|
||||
TEST_ASSERT_EQUAL_STRING("3", output[NUM_SCREENS - 1].c_str());
|
||||
|
||||
std::string joined = joinArrayWithBrackets(output);
|
||||
|
||||
TEST_ASSERT_EQUAL_STRING_MESSAGE("SATS/USD", output[0].c_str(), joined.c_str());
|
||||
TEST_ASSERT_EQUAL_STRING_MESSAGE("0", output[NUM_SCREENS - 5].c_str(), joined.c_str());
|
||||
TEST_ASSERT_EQUAL_STRING_MESSAGE(".", output[NUM_SCREENS - 4].c_str(), joined.c_str());
|
||||
TEST_ASSERT_EQUAL_STRING_MESSAGE("8", output[NUM_SCREENS - 3].c_str(), joined.c_str());
|
||||
TEST_ASSERT_EQUAL_STRING_MESSAGE("3", output[NUM_SCREENS - 2].c_str(), joined.c_str());
|
||||
TEST_ASSERT_EQUAL_STRING_MESSAGE("3", output[NUM_SCREENS - 1].c_str(), joined.c_str());
|
||||
}
|
||||
|
||||
void test_CorrectSatsPerPoundConversion(void)
|
||||
|
@ -272,6 +275,18 @@ void test_Mcap1TrillionJpySmallChars(void)
|
|||
TEST_ASSERT_EQUAL_STRING("000", output[NUM_SCREENS - 1].c_str());
|
||||
}
|
||||
|
||||
void test_PriceDataWithCurrencyCode(void)
|
||||
{
|
||||
std::array<std::string, NUM_SCREENS> output = parsePriceData(100000, "PYG", false, false, false);
|
||||
TEST_ASSERT_EQUAL_STRING("BTC/PYG", output[0].c_str());
|
||||
}
|
||||
|
||||
void test_SatsPerCurrencyWithCurrencyCode(void)
|
||||
{
|
||||
std::array<std::string, NUM_SCREENS> output = parseSatsPerCurrency(100000, "ZAR", false);
|
||||
TEST_ASSERT_EQUAL_STRING("SATS/ZAR", output[0].c_str());
|
||||
}
|
||||
|
||||
// not needed when using generate_test_runner.rb
|
||||
int runUnityTests(void)
|
||||
{
|
||||
|
@ -295,6 +310,8 @@ int runUnityTests(void)
|
|||
RUN_TEST(test_PriceSuffixModeCompact2);
|
||||
RUN_TEST(test_PriceSuffixModeMow);
|
||||
RUN_TEST(test_PriceSuffixModeMowCompact);
|
||||
RUN_TEST(test_PriceDataWithCurrencyCode);
|
||||
RUN_TEST(test_SatsPerCurrencyWithCurrencyCode);
|
||||
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue