コード例 #1
0
TEST(JsonTest, LoadInvalidValue)
{
    ScopedDevice sd1(sample_invalid_device_flags);
    ASSERT_EQ(sd1.device, nullptr);
    ASSERT_EQ(sd1.error.type, MB_DEVICE_JSON_UNKNOWN_VALUE);
    ASSERT_STREQ(sd1.error.context, ".flags[0]");

    ScopedDevice sd2(sample_invalid_tw_flags);
    ASSERT_EQ(sd2.device, nullptr);
    ASSERT_EQ(sd2.error.type, MB_DEVICE_JSON_UNKNOWN_VALUE);
    ASSERT_STREQ(sd2.error.context, ".boot_ui.flags[0]");

    ScopedDevice sd3(sample_invalid_tw_pixel_format);
    ASSERT_EQ(sd3.device, nullptr);
    ASSERT_EQ(sd3.error.type, MB_DEVICE_JSON_UNKNOWN_VALUE);
    ASSERT_STREQ(sd3.error.context, ".boot_ui.pixel_format");

    ScopedDevice sd4(sample_invalid_tw_force_pixel_format);
    ASSERT_EQ(sd4.device, nullptr);
    ASSERT_EQ(sd4.error.type, MB_DEVICE_JSON_UNKNOWN_VALUE);
    ASSERT_STREQ(sd4.error.context, ".boot_ui.force_pixel_format");
}
コード例 #2
0
ファイル: ex7_11.cpp プロジェクト: KwangKa/CppPrimer5th
int main() {
    std::cout << "Default Constructor" << std::endl;
    Sales_data sd1;
    print(std::cout, sd1);
    std::cout << std::endl;
    
    std::cout << "Construct with bookNo" << std::endl;
    Sales_data sd2("978-7-121");
    print(std::cout, sd2);
    std::cout << std::endl;
    
    std::cout << "Construct with bookNo, units_sold, price" << std::endl;
    Sales_data sd3("978-7-121", 3, 25);
    print(std::cout, sd3);
    std::cout << std::endl;

    std::cout << "Construct with istream std::cin" << std::endl;
    Sales_data sd4(std::cin);
    print(std::cout, sd4);
    std::cout << std::endl;

    return 0;
}