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


C++ CORRADE_VERIFY函数代码示例

本文整理汇总了C++中CORRADE_VERIFY函数的典型用法代码示例。如果您正苦于以下问题:C++ CORRADE_VERIFY函数的具体用法?C++ CORRADE_VERIFY怎么用?C++ CORRADE_VERIFY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: CORRADE_VERIFY

void WavImporterTest::stereo8() {
    WavImporter importer;
    CORRADE_VERIFY(importer.openFile(Utility::Directory::join(WAVAUDIOIMPORTER_TEST_DIR, "stereo8.wav")));

    CORRADE_COMPARE(importer.format(), Buffer::Format::Stereo8);
    CORRADE_COMPARE(importer.frequency(), 96000);
    Containers::Array<unsigned char> data = importer.data();
    CORRADE_COMPARE(data.size(), 4);
    CORRADE_COMPARE(data[0], 0xde);
    CORRADE_COMPARE(data[1], 0xfe);
    CORRADE_COMPARE(data[2], 0xca);
    CORRADE_COMPARE(data[3], 0x7e);
}
开发者ID:ArEnSc,项目名称:magnum,代码行数:13,代码来源:WavImporterTest.cpp

示例2: CORRADE_VERIFY

void StaticArrayTest::convertStaticViewDerived() {
    struct A { int i; };
    struct B: A {};

    /* Valid use case: constructing Containers::ArrayView<Math::Vector<3, Float>>
       from Containers::ArrayView<Color3> because the data have the same size
       and data layout */

    CORRADE_VERIFY((std::is_convertible<Containers::StaticArray<5, B>, Containers::StaticArrayView<5, A>>::value));

    {
        CORRADE_EXPECT_FAIL("Intentionally not forbidding construction of base array from larger derived type to stay compatible with raw arrays");

        struct C: A { int b; };

        /* Array of 5 Cs has larger size than array of 5 As so it does not make
           sense to create the view from it, but we are keeping compatibility with
           raw arrays and thus allow the users to shoot themselves in a foot. */

        CORRADE_VERIFY(!(std::is_convertible<Containers::StaticArray<5, C>, Containers::StaticArrayView<5, A>>::value));
    }
}
开发者ID:andylon,项目名称:corrade,代码行数:22,代码来源:StaticArrayTest.cpp

示例3: CORRADE_SKIP

void BufferGLTest::mapRangeExplicitFlush() {
    #ifndef MAGNUM_TARGET_GLES
    if(!Context::current().isExtensionSupported<Extensions::GL::ARB::map_buffer_range>())
        CORRADE_SKIP(Extensions::GL::ARB::map_buffer_range::string() + std::string(" is not supported"));
    #elif defined(MAGNUM_TARGET_GLES2)
    if(!Context::current().isExtensionSupported<Extensions::GL::EXT::map_buffer_range>())
        CORRADE_SKIP(Extensions::GL::EXT::map_buffer_range::string() + std::string(" is not supported"));
    #endif

    constexpr char data[] = {2, 7, 5, 13, 25};
    Buffer buffer;
    buffer.setData(data, BufferUsage::StaticDraw);

    /* Map, set byte, don't flush and unmap */
    char* contents = buffer.map<char>(1, 4, Buffer::MapFlag::Write|Buffer::MapFlag::FlushExplicit);
    CORRADE_VERIFY(contents);
    contents[2] = 99;
    CORRADE_VERIFY(buffer.unmap());
    MAGNUM_VERIFY_NO_ERROR();

    /* Unflushed range _might_ not be changed, thus nothing to test */

    /* Map, set byte, flush and unmap */
    contents = buffer.map<char>(1, 4, Buffer::MapFlag::Write|Buffer::MapFlag::FlushExplicit);
    CORRADE_VERIFY(contents);
    contents[3] = 107;
    buffer.flushMappedRange(3, 1);
    MAGNUM_VERIFY_NO_ERROR();
    CORRADE_VERIFY(buffer.unmap());
    MAGNUM_VERIFY_NO_ERROR();

    /* Flushed range should be changed */
    /** @todo How to verify the contents in ES? */
    #ifndef MAGNUM_TARGET_GLES
    Containers::Array<char> changedContents = buffer.data<char>();
    CORRADE_COMPARE(changedContents.size(), 5);
    CORRADE_COMPARE(changedContents[4], 107);
    #endif
}
开发者ID:Asuzer,项目名称:magnum,代码行数:39,代码来源:BufferGLTest.cpp

示例4: CORRADE_VERIFY

void ArrayTest::customDeleterType() {
    int data[25]{};
    int deletedCount = 0;

    {
        Containers::Array<int, CustomDeleter> a{data, 25, CustomDeleter{deletedCount}};
        CORRADE_VERIFY(a == data);
        CORRADE_COMPARE(a.size(), 25);
        CORRADE_COMPARE(deletedCount, 0);
    }

    CORRADE_COMPARE(deletedCount, 25);
}
开发者ID:mdietsch,项目名称:corrade,代码行数:13,代码来源:ArrayTest.cpp

示例5: CORRADE_SKIP

void TextureGLTest::construct() {
    if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_rectangle>())
        CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported."));

    {
        RectangleTexture texture;

        MAGNUM_VERIFY_NO_ERROR();
        CORRADE_VERIFY(texture.id() > 0);
    }

    MAGNUM_VERIFY_NO_ERROR();
}
开发者ID:severin-lemaignan,项目名称:magnum,代码行数:13,代码来源:RectangleTextureGLTest.cpp

示例6: CORRADE_VERIFY

void AbstractShaderProgramTest::attributeVectorBGRA() {
    #ifndef MAGNUM_TARGET_GLES
    typedef AbstractShaderProgram::Attribute<3, Vector4> Attribute;
    CORRADE_VERIFY((std::is_same<Attribute::ScalarType, Float>{}));
    CORRADE_COMPARE(Attribute::VectorCount, 1);

    /* BGRA */
    Attribute a(Attribute::Components::BGRA);
    CORRADE_COMPARE(a.vectorSize(), 4*4);
    #else
    CORRADE_SKIP("BGRA attribute component ordering is not available in OpenGL ES.");
    #endif
}
开发者ID:DYSEQTA,项目名称:magnum,代码行数:13,代码来源:AbstractShaderProgramTest.cpp

示例7: CORRADE_VERIFY

void StateMachineTest::signalData() {
    #ifndef CORRADE_MSVC2015_COMPATIBILITY
    Implementation::SignalData data1{&StateMachine::entered<State::Start>};
    Implementation::SignalData data2{&StateMachine::entered<State::End>};
    Implementation::SignalData data3{&StateMachine::exited<State::Start>};

    Implementation::SignalData data4{&StateMachine::stepped<State::Start, State::End>};
    Implementation::SignalData data5{&StateMachine::stepped<State::End, State::Start>};
    #else
    auto data1 = Implementation::SignalData::create<StateMachine>(&StateMachine::entered<State::Start>);
    auto data2 = Implementation::SignalData::create<StateMachine>(&StateMachine::entered<State::End>);
    auto data3 = Implementation::SignalData::create<StateMachine>(&StateMachine::exited<State::Start>);

    auto data4 = Implementation::SignalData::create<StateMachine>(&StateMachine::stepped<State::Start, State::End>);
    auto data5 = Implementation::SignalData::create<StateMachine>(&StateMachine::stepped<State::End, State::Start>);
    #endif

    CORRADE_VERIFY(data1 != data2);
    CORRADE_VERIFY(data1 != data3);

    CORRADE_VERIFY(data4 != data5);
}
开发者ID:BrainlessLabsInc,项目名称:corrade,代码行数:22,代码来源:StateMachineTest.cpp

示例8: CORRADE_COMPARE

void ArrayReferenceTest::constReference() {
    const int a[] = {3, 4, 7, 12, 0, -15};

    ConstArrayReference b = a;
    CORRADE_COMPARE(b.size(), 6);
    CORRADE_COMPARE(b[2], 7);

    int c[3];
    ArrayReference d = c;
    ConstArrayReference e = d;
    CORRADE_VERIFY(e == c);
    CORRADE_COMPARE(e.size(), 3);
}
开发者ID:piaoger,项目名称:corrade,代码行数:13,代码来源:ArrayReferenceTest.cpp

示例9: a

void ShapeTest::collides() {
    Scene3D scene;
    ShapeGroup3D shapes;
    Object3D a(&scene);
    Shape<Shapes::Sphere3D> aShape(a, {{1.0f, -2.0f, 3.0f}, 1.5f}, &shapes);

    {
        /* Collision with point inside the sphere */
        Shape<Shapes::Point3D> aShape2(a, {{1.0f, -2.0f, 3.0f}}, &shapes);
        shapes.setClean();
        CORRADE_VERIFY(aShape.collides(aShape2));
    } {
        /* No collision with point inside the sphere, but not in the same group */
        ShapeGroup3D shapes2;
        Shape<Shapes::Point3D> aShape3(a, {{1.0f, -2.0f, 3.0f}}, &shapes2);
        shapes2.setClean();
        CORRADE_VERIFY(!aShape.collides(aShape3));
    } {
        CORRADE_EXPECT_FAIL("Should cross-scene collision work or not?");
        /* No collision with point inside the sphere, but not in the same scene */
        Scene3D scene2;
        Object3D c(&scene2);
        Shape<Shapes::Point3D> cShape(c, {{1.0f, -2.0f, 3.0f}}, &shapes);
        shapes.setClean();
        CORRADE_VERIFY(!aShape.collides(cShape));
    } {
        /* No collision with point outside of the sphere */
        Object3D b(&scene);
        Shape<Shapes::Point3D> bShape(b, {{3.0f, -2.0f, 3.0f}}, &shapes);
        shapes.setClean();
        CORRADE_VERIFY(!aShape.collides(bShape));

        /* Move point inside the sphere -- collision */
        b.translate(Vector3::xAxis(-1.0f));
        shapes.setClean();
        CORRADE_VERIFY(aShape.collides(bShape));
    }
}
开发者ID:NextGenIntelligence,项目名称:magnum,代码行数:38,代码来源:ShapeTest.cpp

示例10: CORRADE_COMPARE

void RigidMatrixTransformation2DTest::setTransformation() {
    Object2D o;

    /* Can't transform with non-rigid transformation */
    std::ostringstream out;
    Error::setOutput(&out);
    o.setTransformation(Matrix3::scaling(Vector2(3.0f)));
    CORRADE_COMPARE(out.str(), "SceneGraph::RigidMatrixTransformation2D::setTransformation(): the matrix doesn't represent rigid transformation\n");

    /* Dirty after setting transformation */
    o.setClean();
    CORRADE_VERIFY(!o.isDirty());
    o.setTransformation(Matrix3::rotation(Deg(17.0f)));
    CORRADE_VERIFY(o.isDirty());
    CORRADE_COMPARE(o.transformationMatrix(), Matrix3::rotation(Deg(17.0f)));

    /* Scene cannot be transformed */
    Scene2D s;
    s.setClean();
    s.setTransformation(Matrix3::rotation(Deg(17.0f)));
    CORRADE_VERIFY(!s.isDirty());
    CORRADE_COMPARE(s.transformationMatrix(), Matrix3());
}
开发者ID:ariosx,项目名称:magnum,代码行数:23,代码来源:RigidMatrixTransformation2DTest.cpp

示例11: CORRADE_VERIFY

void ArgumentsTest::prefixedParse() {
    Arguments arg1;
    arg1.addArgument("file")
        .addBooleanOption('b', "binary")
        .addOption("speed")
        .addSkippedPrefix("read");

    Arguments arg2{"read"};
    arg2.addOption("behavior")
        .addOption("buffer-size");

    const char* argv[] = { "", "-b", "--read-behavior", "buffered", "--speed", "fast", "--binary", "--read-buffer-size", "4K", "file.dat" };
    const int argc = std::extent<decltype(argv)>();

    CORRADE_VERIFY(arg1.tryParse(argc, argv));
    CORRADE_VERIFY(arg1.isSet("binary"));
    CORRADE_COMPARE(arg1.value("speed"), "fast");
    CORRADE_COMPARE(arg1.value("file"), "file.dat");

    CORRADE_VERIFY(arg2.tryParse(argc, argv));
    CORRADE_COMPARE(arg2.value("behavior"), "buffered");
    CORRADE_COMPARE(arg2.value("buffer-size"), "4K");
}
开发者ID:BrainlessLabsInc,项目名称:corrade,代码行数:23,代码来源:ArgumentsTest.cpp

示例12: defined

void QuaternionTest::convert() {
    constexpr Quat a{1.5f, -3.5f, 7.0f, -0.5f};
    constexpr Quaternion b{{1.5f, -3.5f, 7.0f}, -0.5f};

    /* GCC 5.1 fills the result with zeros instead of properly calling
       delegated copy constructor if using constexpr. Reported here:
       https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 */
#if !defined(__GNUC__) || defined(__clang__)
    constexpr
#endif
    Quaternion c {a};
    CORRADE_COMPARE(c, b);

    constexpr Quat d(b);
    CORRADE_COMPARE(d.x, a.x);
    CORRADE_COMPARE(d.y, a.y);
    CORRADE_COMPARE(d.z, a.z);
    CORRADE_COMPARE(d.w, a.w);

    /* Implicit conversion is not allowed */
    CORRADE_VERIFY(!(std::is_convertible<Quat, Quaternion>::value));
    CORRADE_VERIFY(!(std::is_convertible<Quaternion, Quat>::value));
}
开发者ID:smspillaz,项目名称:magnum,代码行数:23,代码来源:QuaternionTest.cpp

示例13: CORRADE_SKIP

void ContextGLTest::isExtensionSupported() {
    #ifndef MAGNUM_TARGET_GLES
    if(Context::current()->isExtensionSupported<Extensions::GL::GREMEDY::string_marker>())
        CORRADE_SKIP(Extensions::GL::GREMEDY::string_marker::string() + std::string(" extension should not be supported, can't test"));

    if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_filter_anisotropic>())
        CORRADE_SKIP(Extensions::GL::EXT::texture_filter_anisotropic::string() + std::string(" extension should be supported, can't test"));

    if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::explicit_attrib_location>())
        CORRADE_SKIP(Extensions::GL::ARB::explicit_attrib_location::string() + std::string(" extension should be supported, can't test"));

    /* Test that we have proper extension list parser */
    std::string extensions(reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)));
    CORRADE_VERIFY(extensions.find(Extensions::GL::EXT::texture_filter_anisotropic::string()) != std::string::npos);
    CORRADE_VERIFY(extensions.find(Extensions::GL::GREMEDY::string_marker::string()) == std::string::npos);

    /* This is disabled in GL < 3.2 to work around GLSL compiler bugs */
    CORRADE_VERIFY(!Context::current()->isExtensionSupported<Extensions::GL::ARB::explicit_attrib_location>(Version::GL310));
    CORRADE_VERIFY(Context::current()->isExtensionSupported<Extensions::GL::ARB::explicit_attrib_location>(Version::GL320));
    #else
    CORRADE_SKIP("No useful extensions to test on OpenGL ES");
    #endif
}
开发者ID:DYSEQTA,项目名称:magnum,代码行数:23,代码来源:ContextGLTest.cpp

示例14: CORRADE_VERIFY

void AbstractShaderProgramTest::attributeVector4() {
    typedef Attribute<3, Vector4> Attribute;
    CORRADE_VERIFY((std::is_same<Attribute::ScalarType, Float>{}));
    CORRADE_COMPARE(Attribute::VectorCount, 1);

    /* Custom type */
    #ifndef MAGNUM_TARGET_GLES
    Attribute a(Attribute::DataType::UnsignedInt2101010Rev);
    CORRADE_COMPARE(a.vectorSize(), 4);
    #else
    Attribute a(Attribute::DataType::HalfFloat);
    CORRADE_COMPARE(a.vectorSize(), 8);
    #endif
}
开发者ID:NextGenIntelligence,项目名称:magnum,代码行数:14,代码来源:AbstractShaderProgramTest.cpp

示例15: CORRADE_COMPARE

void DualComplexTransformationTest::setTransformation() {
    Object2D o;

    /* Can't transform with non-rigid transformation */
    std::ostringstream out;
    Error::setOutput(&out);
    o.setTransformation(DualComplex({1.0f, 2.0f}, {}));
    CORRADE_COMPARE(out.str(), "SceneGraph::DualComplexTransformation::setTransformation(): the dual complex number is not normalized\n");

    /* Dirty after setting transformation */
    o.setClean();
    CORRADE_VERIFY(!o.isDirty());
    o.setTransformation(DualComplex::rotation(Deg(17.0f)));
    CORRADE_VERIFY(o.isDirty());
    CORRADE_COMPARE(o.transformationMatrix(), Matrix3::rotation(Deg(17.0f)));

    /* Scene cannot be transformed */
    Scene2D s;
    s.setClean();
    s.setTransformation(DualComplex::rotation(Deg(17.0f)));
    CORRADE_VERIFY(!s.isDirty());
    CORRADE_COMPARE(s.transformationMatrix(), Matrix3());
}
开发者ID:DYSEQTA,项目名称:magnum,代码行数:23,代码来源:DualComplexTransformationTest.cpp


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