initialize_fpu();
int test_main(int, char*[]){// TODO ?? Copied from round_to_test.cpp; abstract this into a header.#if defined __GNUC__ && defined _X86_    // Set floating-point control word to intel default.    asm volatile ("fldcw %0" : : "m" (0x037f));#elif defined __BORLANDC__    _control87(0x037f,  0xffff);#elif defined BOOST_MSVC    // Untested, but this appears to be the right nonstandard function.    _control87(0x001f,   _MCW_EM);    _control87(_RC_NEAR, _MCW_RC);    _control87(_PC_64,   _MCW_PC);#else // No known way to set rounding style.    std::cerr        << "\nCannot set floating-point precision.\n"        << "Results may be invalid.\n"        << "Please consider contributing an implementation \n"        << "for your compiler.\n"        ;#endif // No known way to set rounding style.    // Test IllusInputParms << and >> operators.    IllusInputParms original;    IllusInputParms replica;    std::ofstream os0        ("eraseme0.xml"        ,   std::ios_base::out          | std::ios_base::trunc          | std::ios_base::binary        );    BOOST_TEST(!!os0);    // The obsolete first-, middle-, and last-name fields live on    // in base class 'InputParms', but the full name now actually    // resides in its first-name field, which is mapped to a single    // field in derived class 'IllusInputParms'.    original.AgentFirstName     = "Herbert Cassidy";    original.AgentPhone         = "123-4567";    original.InsdFirstName      = "Actually Full Name";    original.InsdAddr1          = "addr1";    original.InsdAddr2          = "addr2";    original.InsdCity           = "city";//    original.FundAllocations    = "0.4 0.3 0.2 0.1";    original.SepAcctIntRate     = "0.03125";/*    original.FundAllocs[0]      = 1.0;    original.SepAcctRate[0]     = .01234567890123456789;    original.SepAcctRate[1]     = .12345678901234567890;    original.SepAcctRate[2]     = .23456789012345678901;    original.SepAcctRate[3]     = .34567890123456789012;    original.SepAcctRate[4]     = .45678901234567890123;    original.SepAcctRate[5]     = .56789012345678901234;    original.SepAcctRate[6]     = .67890123456789012345;    original.SepAcctRate[7]     = .78901234567890123456;    original.SepAcctRate[8]     = .89012345678901234567;    original.SepAcctRate[9]     = .90123456789012345678;*/    original.propagate_changes_to_base_and_finalize();    xml::init init;    xml::node xml_root0("root");    xml_root0 << original;    os0 << xml_root0;    os0.close();    xml::node xml_node;    xml::node::iterator child = xml_root0.begin();    if(child->is_text())        {        // TODO ?? Explain what this does.        ++child;        }    if(!child->is_text())        {        xml_node = *child;        }    xml_node >> replica;    std::ofstream os1        ("eraseme1.xml"        ,   std::ios_base::out          | std::ios_base::trunc          | std::ios_base::binary        );    BOOST_TEST(!!os1);    xml::node xml_root1("root");    xml_root1 << replica;    os1 << xml_root1;    os1.close();    BOOST_TEST(original == replica);    BOOST_TEST(files_are_identical("eraseme0.xml", "eraseme1.xml"));    BOOST_TEST(0.03125 == original.SepAcctRate[0]);    BOOST_TEST(0.03125 == replica.SepAcctRate[0]);//std::cout << "original.SepAcctRate[0] is " << original.SepAcctRate[0] << '\n';//std::cout << "replica.SepAcctRate[0] is " << replica.SepAcctRate[0] << '\n';/* The code this tests is defective--fix it someday.    BOOST_TEST(0.4 == original.FundAllocs[0]);    BOOST_TEST(0.4 == replica.FundAllocs[0]);std::cout << "original.FundAllocs[0] is " << original.FundAllocs[0] << '\n';std::cout << "replica.FundAllocs[0] is " << replica.FundAllocs[0] << '\n';std::cout << "original.FundAllocs.size() is " << original.FundAllocs.size() << '\n';std::cout << "replica.FundAllocs.size() is " << replica.FundAllocs.size() << '\n';*/    BOOST_TEST(0 == std::remove("eraseme0.xml"));    BOOST_TEST(0 == std::remove("eraseme1.xml"));    BOOST_TEST(0 == original.InforceYear);#ifndef BC_BEFORE_5_5    original["InforceYear"] = std::string("3");#else // Old borland compiler.    original.set_value_by_name("InforceYear", std::string("3"));#endif // Old borland compiler.    BOOST_TEST(3 == original.InforceYear);    BOOST_TEST(45 == original.Status_IssueAge);#ifndef BC_BEFORE_5_5    original["IssueAge"] = std::string("57");#else // Old borland compiler.    original.set_value_by_name("IssueAge", std::string("57"));#endif // Old borland compiler.    BOOST_TEST(57 == original.Status_IssueAge);    // Unfortunately, this can't get updated automatically:    BOOST_TEST(45 == original.Status[0].IssueAge);    // Test copy constructor.    original.propagate_changes_to_base_and_finalize();    IllusInputParms copy0(original);    copy0.propagate_changes_from_base_and_finalize();//    BOOST_TEST(original == copy0); // TODO ?? Fails.#ifndef BC_BEFORE_5_5    copy0["InsuredName"] = "Claude Proulx";#else // Old borland compiler.    copy0.set_value_by_name("InsuredName", std::string("Claude Proulx"));#endif // Old borland compiler.    BOOST_TEST(std::string("Claude Proulx") == copy0   .InsdFirstName);    BOOST_TEST(std::string("Actually Full Name") == original.InsdFirstName);    BOOST_TEST(std::string("") == copy0   .InsdMiddleName);    BOOST_TEST(std::string("") == original.InsdMiddleName);    BOOST_TEST(std::string("") == copy0   .InsdLastName);    BOOST_TEST(std::string("") == original.InsdLastName);    // Reset this in case it changed.    original.InsdFirstName      = "Actually Full Name";    // Test assignment operator.    IllusInputParms copy1;    original.propagate_changes_to_base_and_finalize();    copy1 = original;    copy1.propagate_changes_from_base_and_finalize();//    BOOST_TEST(original == copy1); // TODO ?? Fails.#ifndef BC_BEFORE_5_5    copy1["InsuredName"] = "Angela";#else // Old borland compiler.    copy1.set_value_by_name("FirstName", std::string("Angela"));#endif // Old borland compiler.    BOOST_TEST(std::string("Angela") == copy1   .InsdFirstName);    BOOST_TEST(std::string("Actually Full Name")  == original.InsdFirstName);    return 0;}