本文整理汇总了C++中CORRADE_VERIFY函数的典型用法代码示例。如果您正苦于以下问题:C++ CORRADE_VERIFY函数的具体用法?C++ CORRADE_VERIFY怎么用?C++ CORRADE_VERIFY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CORRADE_VERIFY函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: CORRADE_VERIFY
void StaticArrayViewTest::access() {
int a[7];
StaticArrayView<7> b = a;
for(std::size_t i = 0; i != 7; ++i)
b[i] = i;
CORRADE_VERIFY(b.data() == a);
CORRADE_COMPARE(*(b.begin()+2), 2);
CORRADE_COMPARE(b[4], 4);
CORRADE_COMPARE(b.end()-b.begin(), 7);
ConstStaticArrayView<7> c = a;
CORRADE_COMPARE(c.data(), a);
}
开发者ID:MiUishadow,项目名称:corrade,代码行数:14,代码来源:StaticArrayViewTest.cpp
示例17: CORRADE_VERIFY
void TgaImporterTest::colorBits32() {
TgaImporter importer;
const char data[] = {
0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 3, 0, 32, 0,
1, 2, 3, 1, 2, 3, 4, 1,
3, 4, 5, 1, 4, 5, 6, 1,
5, 6, 7, 1, 6, 7, 8, 1
};
const char pixels[] = {
3, 2, 1, 1, 4, 3, 2, 1,
5, 4, 3, 1, 6, 5, 4, 1,
7, 6, 5, 1, 8, 7, 6, 1
};
CORRADE_VERIFY(importer.openData(data));
std::optional<Trade::ImageData2D> image = importer.image2D(0);
CORRADE_VERIFY(image);
CORRADE_COMPARE(image->format(), ColorFormat::RGBA);
CORRADE_COMPARE(image->size(), Vector2i(2, 3));
CORRADE_COMPARE(image->type(), ColorType::UnsignedByte);
CORRADE_COMPARE((std::string{image->data(), 2*3*3}),
(std::string{pixels, 2*3*3}));
}
开发者ID:msomeone,项目名称:magnum,代码行数:23,代码来源:TgaImporterTest.cpp
示例18: CORRADE_VERIFY
void DdsImporterTest::rgbVolume() {
DdsImporter importer;
CORRADE_VERIFY(importer.openFile(Utility::Directory::join(DDSIMPORTER_TEST_DIR, "rgb_uncompressed_volume.dds")));
const char pixels[] = {
/* slice 0 */
'\xde', '\xad', '\xb5',
'\xca', '\xfe', '\x77',
'\xde', '\xad', '\xb5',
'\xca', '\xfe', '\x77',
'\xde', '\xad', '\xb5',
'\xca', '\xfe', '\x77',
/* slice 1 */
'\xca', '\xfe', '\x77',
'\xde', '\xad', '\xb5',
'\xca', '\xfe', '\x77',
'\xde', '\xad', '\xb5',
'\xca', '\xfe', '\x77',
'\xde', '\xad', '\xb5',
/* slice 2 */
'\xde', '\xad', '\xb5',
'\xca', '\xfe', '\x77',
'\xde', '\xad', '\xb5',
'\xca', '\xfe', '\x77',
'\xde', '\xad', '\xb5',
'\xca', '\xfe', '\x77'};
std::optional<Trade::ImageData3D> image = importer.image3D(0);
CORRADE_VERIFY(image);
CORRADE_VERIFY(!image->isCompressed());
CORRADE_COMPARE(image->storage().alignment(), 1);
CORRADE_COMPARE(image->size(), Vector3i(3, 2, 3));
CORRADE_COMPARE(image->format(), PixelFormat::RGB);
CORRADE_COMPARE(image->type(), PixelType::UnsignedByte);
CORRADE_COMPARE_AS(image->data(), Containers::ArrayView<const char>(pixels),
TestSuite::Compare::Container);
}
开发者ID:Squareys,项目名称:magnum-plugins,代码行数:37,代码来源:DdsImporterTest.cpp
示例19: MAGNUM_VERIFY_NO_ERROR
void BufferImageGLTest::constructMove() {
const char data[4] = { 'a', 'b', 'c', 'd' };
BufferImage2D a{PixelFormat::Red, PixelType::UnsignedByte, {4, 1}, data, BufferUsage::StaticDraw};
const Int id = a.buffer().id();
MAGNUM_VERIFY_NO_ERROR();
CORRADE_VERIFY(id > 0);
BufferImage2D b(std::move(a));
CORRADE_COMPARE(a.buffer().id(), 0);
CORRADE_COMPARE(a.size(), Vector2i());
CORRADE_COMPARE(b.storage().alignment(), 4);
CORRADE_COMPARE(b.format(), PixelFormat::Red);
CORRADE_COMPARE(b.type(), PixelType::UnsignedByte);
CORRADE_COMPARE(b.size(), Vector2i(4, 1));
CORRADE_COMPARE(b.buffer().id(), id);
const unsigned short data2[2*4] = { 1, 2, 3, 4, 5, 6, 7, 8 };
BufferImage2D c{PixelStorage{}.setAlignment(1),
PixelFormat::RGBA, PixelType::UnsignedShort, {1, 2}, data2, BufferUsage::StaticDraw};
const Int cId = c.buffer().id();
c = std::move(b);
MAGNUM_VERIFY_NO_ERROR();
CORRADE_VERIFY(cId > 0);
CORRADE_COMPARE(b.buffer().id(), cId);
CORRADE_COMPARE(b.size(), Vector2i(1, 2));
CORRADE_COMPARE(c.storage().alignment(), 4);
CORRADE_COMPARE(c.format(), PixelFormat::Red);
CORRADE_COMPARE(c.type(), PixelType::UnsignedByte);
CORRADE_COMPARE(c.size(), Vector2i(4, 1));
CORRADE_COMPARE(c.buffer().id(), id);
}
开发者ID:jkhoogland,项目名称:magnum,代码行数:37,代码来源:BufferImageGLTest.cpp
示例20: CORRADE_COMPARE
void DualQuaternionTransformationTest::setTransformation() {
Object3D o;
/* Can't transform with non-rigid transformation */
std::ostringstream out;
Error redirectError{&out};
o.setTransformation(DualQuaternion({{1.0f, 2.0f, 3.0f}, 4.0f}, {}));
CORRADE_COMPARE(out.str(), "SceneGraph::DualQuaternionTransformation::setTransformation(): the dual quaternion is not normalized\n");
/* Dirty after setting transformation */
o.setClean();
CORRADE_VERIFY(!o.isDirty());
o.setTransformation(DualQuaternion::rotation(Deg(17.0f), Vector3::xAxis()));
CORRADE_VERIFY(o.isDirty());
CORRADE_COMPARE(o.transformationMatrix(), Matrix4::rotationX(Deg(17.0f)));
/* Scene cannot be transformed */
Scene3D s;
s.setClean();
CORRADE_VERIFY(!s.isDirty());
s.setTransformation(DualQuaternion::rotation(Deg(17.0f), Vector3::xAxis()));
CORRADE_VERIFY(!s.isDirty());
CORRADE_COMPARE(s.transformationMatrix(), Matrix4());
}
开发者ID:matheboy,项目名称:magnum,代码行数:24,代码来源:DualQuaternionTransformationTest.cpp
注:本文中的CORRADE_VERIFY函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论