当前位置: 首页>>代码示例>>C++>>正文


C++ TestState::fail方法代码示例

本文整理汇总了C++中TestState::fail方法的典型用法代码示例。如果您正苦于以下问题:C++ TestState::fail方法的具体用法?C++ TestState::fail怎么用?C++ TestState::fail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestState的用法示例。


在下文中一共展示了TestState::fail方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Element

void
test_properties()
{
    std::vector<boost::shared_ptr<cygnal::Element> > data1;

    const char *str1 = "property one";
    boost::shared_ptr<cygnal::Element> prop1(new Element(str1));
    data1.push_back(prop1);

    string str2 = "property two";
    boost::shared_ptr<cygnal::Element> prop2(new Element(str2));
    data1.push_back(prop2);

    boost::shared_ptr<cygnal::Element> prop3(new Element("property three"));
    data1.push_back(prop3);

    double num = 123.456;
    boost::shared_ptr<cygnal::Element> prop4(new Element(num));
    data1.push_back(prop4);
    
    Element top;
    top.makeObject("app", data1);
    
    if ((top.propertySize() == 4)
        && (top.getType() == Element::OBJECT_AMF0)
        && (strcmp(top[0]->to_string(), str1) == 0)
        && (top[1]->to_string() == str2)
        && (strcmp(top[2]->to_string(), "property three") == 0)
        && (top[3]->to_number() == num)) {
        runtest.pass("Made object with properties");
    } else {
        runtest.fail("Made object with properties");
    }

    data1.clear();
    top.makeECMAArray(data1);
    if ((top.propertySize() == 4)
        && (top.getType() == Element::ECMA_ARRAY_AMF0)
        && (strcmp(top[0]->to_string(), str1) == 0)
        && (top[1]->to_string() == str2)
        && (strcmp(top[2]->to_string(), "property three") == 0)
        && (top[3]->to_number() == num)) {
        runtest.pass("Made ECMA array");
    } else {
        runtest.fail("Made ECMA array");
    }

    data1.clear();
    top.makeStrictArray(data1);
    if ((top.propertySize() == 4)
        && (top.getType() == Element::STRICT_ARRAY_AMF0)
        && (strcmp(top[0]->to_string(), str1) == 0)
        && (top[1]->to_string() == str2)
        && (strcmp(top[2]->to_string(), "property three") == 0)
        && (top[3]->to_number() == num)) {
        runtest.pass("Made strict array");
    } else {
        runtest.fail("Made strict array");
    }

//    top.dump();
}
开发者ID:BrandRegard,项目名称:gnash,代码行数:62,代码来源:test_el.cpp

示例2:

void
test_construct()
{

    // Test creating number elements. An element with a name is a property.
    double dub = 23.45;
    bool flag = true;
    string str = "Guten Tag";

    Element elnum1(dub);
    if ((elnum1.getType() == Element::NUMBER_AMF0) &&
        (elnum1.to_number() == dub)) {
        runtest.pass("Constructed as double element");
    } else {
        runtest.fail("Constructed as double element");
    }

    flag = true;
    Element elbool1(flag);
    if ((elbool1.getType() == Element::BOOLEAN_AMF0) &&
        (elbool1.to_bool() == true)) {
        runtest.pass("Constructed as bool element");
    } else {
        runtest.fail("Constructed as bool element");
    }

    Element elstr1(str);
    if ((elstr1.getType() == Element::STRING_AMF0) &&
        (elstr1.getDataSize() == str.size())) {
        runtest.pass("Constructed as string element");
    } else {
        runtest.fail("Constructed as string element");
    }
    // And now test constrcutors with variable names
    dub = 23.45;
    Element elnum2(dub);
    if ((elnum2.getType() == Element::NUMBER_AMF0) &&
        (elnum2.to_number() == dub)) {
        runtest.pass("Constructed as double element with name");
    } else {
        runtest.fail("Constructed as double element with name");
    }

    flag = true;
    Element elbool2(flag);
    if ((elbool2.getType() == Element::BOOLEAN_AMF0) &&
        (elbool2.to_bool() == true)) {
        runtest.pass("Constructed as bool element with name");
    } else {
        runtest.fail("Constructed as bool element with name");
    }

    str = "Aloha";
    Element elstr2(str);
    if ((elstr2.getType() == Element::STRING_AMF0) &&
        (elstr2.getDataSize() == str.size())) {
        runtest.pass("Constructed as string element with name");
    } else {
        runtest.fail("Constructed as string element with name");
    }
}
开发者ID:BrandRegard,项目名称:gnash,代码行数:61,代码来源:test_el.cpp

示例3:

int
main(int argc, char *argv[])
{
    // FIXME: for now, always run verbose till this supports command line args
    dbglogfile.setVerbosity();

    rawfb::RawFBDevice rfb;
    
    if (!rfb.initDevice(argc, argv)) {
        runtest.fail("RawFBDevice:InitDevice()");
    } else {
        runtest.pass("RawFBDevice:InitDevice()");
    }

    bool ret = rfb.attachWindow(rfb.getHandle());
    if (rfb.getFBMemory()) {
        runtest.pass("RawFBDevice::attachWindow()");
    } else {
        runtest.fail("RawFBDevice::attachWindow()");
    }
    
#ifdef ENABLE_DOUBLE_BUFFERING
    if (rfb.getOffscreenBuffer()) {
        runtest.pass("RawFBDevice::getOffscreenBuffer()");
    } else {
        runtest.fail("RawFBDevice::getOffscreenBuffer()");
    }
#else
    runtest.untested("RawFBDevice::getOffscreenBuffer()");
#endif
    
    if (ret && rfb.getStride()) {
        runtest.pass("RawFBDevice::getStride()");
    } else {
        runtest.fail("RawFBDevice::getStride()");
    }
    
    if (ret && rfb.getWidth()) {
        runtest.pass("RawFBDevice::getWidth()");
    } else {
        runtest.fail("RawFBDevice::getWidth()");
    }
    
    if (ret && rfb.getHeight()) {
        runtest.pass("RawFBDevice::getHeight()");
    } else {
        runtest.fail("DirecTFBDevice::getHeight()");
    }

    if (ret && rfb.isSingleBuffered()) {
        runtest.pass("RawFBDevice::is*Buffered()");
    } else {
        runtest.fail("RawFBDevice::is*Buffered()");
    }
    
    if (ret && rfb.getDepth()) {
        runtest.pass("RawFBDevice::getDepth()");
    } else {
        runtest.fail("RawFBDevice::getDepth()");
    }
    
    if (ret && rfb.getRedSize() > 0) {
        runtest.pass("RawFBDevice::getRedSize()");
    } else {
        runtest.fail("RawFBDevice::getRedSize()");
    }

    if (ret && rfb.getGreenSize() > 0) {
        runtest.pass("RawFBDevice::getGreenSize()");
    } else {
        runtest.fail("RawFBDevice::getGreenSize()");
    }

    if (ret && rfb.getBlueSize() > 0) {
        runtest.pass("RawFBDevice::getBlueSize()");
    } else {
        runtest.fail("RawFBDevice::getBlueSize()");
    }

#if 0
    if (rfb.setGrayscaleLUT8()) {
        runtest.pass("RawFBDevice::setGrayscaleLUT8()");
    } else {
        runtest.fail("RawFBDevice::setGrayscaleLUT8()");
    }
#endif
    
    // AGG uses these to calculate the poixel format
#ifdef RENDERER_AGG
    if (ret && rfb.getRedOffset() > 0) {
        runtest.pass("RawFBDevice::getRedOffset()");
    } else {
        runtest.fail("RawFBDevice::getRedOffset()");
    }
    
    if (ret && rfb.getGreenOffset() > 0) {
        runtest.pass("RawFBDevice::getGreenOffset()");
    } else {
        runtest.fail("RawFBDevice::getGreenOffset()");
    }
//.........这里部分代码省略.........
开发者ID:BrandRegard,项目名称:gnash,代码行数:101,代码来源:test_rawfb.cpp


注:本文中的TestState::fail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。