Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Functions
fxdom.cpp File Reference
#include <boost/test/unit_test.hpp>
#include <ored/utilities/parsers.hpp>
#include <oret/toplevelfixture.hpp>

Go to the source code of this file.

Functions

 BOOST_AUTO_TEST_CASE (testFXDominance)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE()

BOOST_AUTO_TEST_CASE ( testFXDominance  )

Definition at line 30 of file fxdom.cpp.

30 {
31 BOOST_TEST_MESSAGE("Testing FXDominance...");
32
33 // List of pairs - we split them up and try both ways
34 const char* expectedPairs[] = {
35 "EURUSD", "GBPUSD", "AUDUSD", "CADJPY", "AUDJPY", "EURNOK", "EURJPY", "EURSEK", "EURCHF", "EURNOK", "NOKJPY",
36 "NOKSEK", "DKKSEK", "CNYJPY", "JPYIDR",
37
38 // another longer list - might have duplicates
39 "AUDCAD", "AUDCHF", "AUDJPY", "AUDNZD", "AUDUSD", "CADJPY", "CADMXN", "CADNOK", "CHFJPY", "EURAUD", "EURCAD",
40 "EURCHF", "EURCZK", "EURDKK", "EURGBP", "EURHUF", "EURJPY", "EURKRW", "EURMXN", "EURNOK", "EURNZD", "EURPLN",
41 "EURRUB", "EURSEK", "EURTRY", "EURUSD", "EURZAR", "GBPAUD", "GBPCAD", "GBPCHF", "GBPJPY", "GBPNOK", "GBPUSD",
42 "JPYKRW", "MXNJPY", "NOKSEK", "NZDCAD", "NZDCHF", "NZDJPY", "NZDUSD", "TRYJPY", "USDCAD", "USDCHF", "USDCNH",
43 "USDCZK", "USDDKK", "USDHKD", "USDHUF", "USDILS", "USDJPY", "USDMXN", "USDNOK", "USDOMR", "USDPLN", "USDRON",
44 "USDRUB", "USDSEK", "USDSGD", "USDTHB", "USDTRY", "USDZAR",
45
46 // XXX for unknown ccys
47 "XXXJPY", "EURXXX", "USDXXX",
48
49 // Some metals
50 "XAUUSD", "XAGUSD", "XPTUSD", "XPDUSD", "XAUEUR", "XAGEUR", "XPTAUD"};
51
52 for (unsigned i = 0; i < sizeof(expectedPairs) / sizeof(expectedPairs[0]); i++) {
53 string expectedPair = expectedPairs[i];
54 string s1 = expectedPair.substr(0, 3);
55 string s2 = expectedPair.substr(3);
56
57 BOOST_TEST_MESSAGE("Combining " << s1 << " and " << s2 << " expecting " << expectedPair);
58 string pair = ore::data::fxDominance(s1, s2);
59 BOOST_CHECK_EQUAL(pair, expectedPair);
60
61 BOOST_TEST_MESSAGE("Combining " << s2 << " and " << s1 << " expecting " << expectedPair);
62 pair = ore::data::fxDominance(s2, s1);
63 BOOST_CHECK_EQUAL(pair, expectedPair);
64 }
65}
string fxDominance(const string &s1, const string &s2)
Convert FX pair to market standard dominance.
Definition: parsers.cpp:1296
+ Here is the call graph for this function: