tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

TestCurrency.cpp (923B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 #include "gtest/gtest.h"
      5 
      6 #include "mozilla/intl/Currency.h"
      7 #include "mozilla/Span.h"
      8 
      9 namespace mozilla::intl {
     10 
     11 TEST(IntlCurrency, GetISOCurrencies)
     12 {
     13  bool hasUSDollar = false;
     14  bool hasEuro = false;
     15  constexpr auto usdollar = MakeStringSpan("USD");
     16  constexpr auto euro = MakeStringSpan("EUR");
     17 
     18  auto currencies = Currency::GetISOCurrencies().unwrap();
     19  for (auto currency : currencies) {
     20    // Check a few currencies, as the list may not be stable between ICU
     21    // updates.
     22    if (currency.unwrap() == usdollar) {
     23      hasUSDollar = true;
     24    }
     25    if (currency.unwrap() == euro) {
     26      hasEuro = true;
     27    }
     28  }
     29 
     30  ASSERT_TRUE(hasUSDollar);
     31  ASSERT_TRUE(hasEuro);
     32 }
     33 
     34 }  // namespace mozilla::intl