本文整理汇总了C++中TestState::pass方法的典型用法代码示例。如果您正苦于以下问题:C++ TestState::pass方法的具体用法?C++ TestState::pass怎么用?C++ TestState::pass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestState
的用法示例。
在下文中一共展示了TestState::pass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: memset
// Make sure we can read and write binary AMF strings
void
test_String(void)
{
AMF amf_obj;
int fd, ret;
char buf[AMF_VIDEO_PACKET_SIZE+1];
// First see if we can read strings. This file is produced by
// using a network packet sniffer, and should be binary correct.
memset(buf, 0, AMF_VIDEO_PACKET_SIZE+1);
fd = open("string1.amf", O_RDONLY);
ret = read(fd, buf, AMF_VIDEO_PACKET_SIZE);
close(fd);
char *str = amf_obj.extractString(buf);
if (strcmp(str, "connect") == 0) {
runtest.pass("Extracted \"connect\" string");
} else {
runtest.fail("Extracted \"connect\" string");
}
// Now make sure we can also create strings. We'll create the same
// string we just read, and make sure they match.
char *connect = "connect";
void *out = amf_obj.encodeElement(AMF::STRING, connect, strlen(connect));
if (memcmp(out, buf, 10) == 0) {
runtest.pass("Encoded \"connect\" string");
} else {
runtest.fail("Encoded \"connect\" string");
}
delete str;
}
示例2: mem
// make sure when we delete a Buffer, *all* the allocated
// memory goes away. As the only way to do this is to examine
// the malloc buffers in the kernel, this will only work on
// POSIX conforming systems, and probabably only Linux & BSD.
void
test_destruct()
{
// these tests are bogus unless you have both mallinfo()
// and also have memory statistics gathering turned on.
#if defined(HAVE_MALLINFO) && defined(USE_STATS_MEMORY)
Memory mem(5);
mem.addStats(__LINE__); // take a sample
Buffer *buf1, *buf2;
mem.startCheckpoint();
buf1 = new Buffer(NETBUFSIZE);
delete buf1;
if (mem.endCheckpoint()) {
runtest.pass ("Buffer::~Buffer()");
} else {
runtest.fail ("Buffer::~Buffer()");
}
mem.startCheckpoint();
buf2 = new Buffer(124);
delete buf2;
if (mem.endCheckpoint()) {
runtest.pass ("Buffer::~Buffer(size_t)");
} else {
runtest.fail ("Buffer::~Buffer(size_t)");
}
#endif
}
示例3: pass
void
test_Boolean(void)
{
AMF amf_obj;
bool bo = false;
// Write a number element
void *out = amf_obj.encodeElement(AMF::BOOLEAN, &bo, 0);
if (amf_obj.extractElementHeader(out) == AMF::BOOLEAN) {
runtest.pass("Boolean header correct");
} else {
runtest.fail("Boolean header not correct");
}
if (amf_obj.extractElementLength(out) == 1) {
runtest.pass("Boolean length returned correct");
} else {
runtest.fail("Boolean length returned not correct");
}
if (*((char *)out + 1) == 0) {
pass("Boolean false returned correct");
} else {
runtest.fail("Boolean false returned not correct");
}
bo = true;
out = amf_obj.encodeElement(AMF::BOOLEAN, &bo, 0);
if (*((char *)out + 1) == 1) {
runtest.pass("Boolean true returned correct");
} else {
runtest.fail("Boolean true returned not correct");
}
}
示例4: a
//
// Machinery for delayed images rendering (e.g. Xv with YV12 or VAAPI)
//
void
test_iterators(Renderer *renderer, const std::string &type)
{
cout << "\t"<< type << " iterator tests" << endl;
if (!renderer) {
runtest.unresolved("No renderer to test!");
return;
}
Renderer::RenderImages::iterator fit = renderer->getFirstRenderImage();
Renderer::RenderImages::iterator lit = renderer->getLastRenderImage();
// When there are no images, the first and last are the same obviously
if (fit == lit) {
runtest.pass("getFirstRenderImage()");
} else {
runtest.fail("getFirstRenderImage()");
}
#if 0
geometry::Point2d a(1, 2);
geometry::Point2d c(3, 4);
Renderer::RenderImage image;
image::GnashImage *frame = new image::ImageRGBA(10, 10);
// gnash::GnashVaapiImage *foo = static_cast<gnash::GnashVaapiImage *>(frame);
// gnash::GnashVaapiImageProxy *bar = new gnash::GnashVaapiImageProxy(foo, a.x, a.y, c.x - a.x, c.y - a.y);
std::auto_ptr<image::GnashImage> rgba(frame);
// image.reset(new gnash::GnashVaapiImageProxy(foo, a.x, a.y, c.x - a.x, c.y - a.y));
renderer->addRenderImage(image);
// image.reset(new gnash::GnashVaapiImageProxy(foo, a.x, a.y, c.x - a.x, c.y - a.y));
renderer->addRenderImage(image);
#endif
fit = renderer->getFirstRenderImage();
lit = renderer->getLastRenderImage();
// When there are no images, the first and last are the same obviously
if (fit != lit) {
runtest.pass("addRenderImage()");
} else {
runtest.fail("addRenderImage()");
}
#if 0
typedef boost::shared_ptr<GnashVaapiImageProxy> RenderImage;
typedef std::vector<RenderImage> RenderImages;
// Get first render image
virtual RenderImages::iterator getFirstRenderImage()
{ return _render_images.begin(); }
virtual RenderImages::const_iterator getFirstRenderImage() const
{ return _render_images.begin(); }
// Get last render image
virtual RenderImages::iterator getLastRenderImage()
{ return _render_images.end(); }
virtual RenderImages::const_iterator getLastRenderImage() const
{ return _render_images.end(); }
#endif
}
示例5:
// Each Renderer has an associated display device, currently EGL
// for OpenVG, OpenGLES1, and OpenGLES2. The DirectFB device is
// also available for these three renderers. The EGL device can
// also be run under X11 using the Mesa libraries. Both EGL and
// DirectFB are primarily for framebuffers. While all of the methods
// of each device class are available to the Renderer, most aren't
// exposed with more accesors beyond these for manipulating the
// device setting itself.
void
test_device(Renderer *renderer, const std::string &type)
{
cout << endl << "Testing " << type << " Device" << endl;
#if 0
boost::shared_array<renderer::GnashDevice::dtype_t> devs = renderer->probeDevices();
if (devs) {
runtest.pass("Renderer::probeDevices()");
} else {
runtest.fail("Renderer::probeDevices()");
}
// Be default, there should be no device associated with this
// renderer yet.
if (renderer->getDevice() == GnashDevice::NODEV) {
runtest.pass("Renderer::getDevice()");
} else {
runtest.fail("Renderer::getDevice()");
}
// Set to a device and see if it's axctually set
renderer->setDevice(GnashDevice::X11);
if (renderer->getDevice() == GnashDevice::X11) {
runtest.pass("Renderer::setDevice()");
} else {
runtest.fail("Renderer::setDevice()");
}
// reset to the original value so we don't screw up future tests
renderer->resetDevice();
#endif
}
示例6: memset
void
test_remove()
{
Network::byte_t *data1 = new Network::byte_t[20];
memset(data1, 0, 20);
Network::byte_t *data2 = new Network::byte_t[20];
memset(data2, 0, 20);
Network::byte_t *data3 = new Network::byte_t[20];
memset(data3, 0, 20);
// populate a buffer with some data
for (size_t i=0; i< 19; i++) {
data1[i] = i + 'a';
}
// Build identical buffer nissing one character
memcpy(data2, data1, 6);
memcpy(data2 + 6, data1 + 7, 20-7);
// Remove a single byte
Network::byte_t byte = 'g';
Buffer buf1(20);
buf1.clear();
buf1.copy(data1, 20);
buf1.remove(byte);
if (memcmp(data2, buf1.reference(), 19) == 0) {
runtest.pass ("Buffer::remove(Network::byte_t)");
} else {
runtest.fail ("Buffer::remove(Network::byte_t)");
}
Buffer buf2(20);
buf2.clear();
buf2.copy(data1, 20);
buf2.remove(6);
if (memcmp(data2, buf2.reference(), 18) == 0) {
runtest.pass ("Buffer::remove(int)");
} else {
runtest.fail ("Buffer::remove(int)");
}
// Remove a range of bytes
memcpy(data3, data1, 6);
memcpy(data3 + 6, data1 + 9, 1);
Buffer buf3(20);
buf3.clear();
buf3.copy(data1, 20);
buf3.remove(6, 8);
if (memcmp(data3, buf3.reference(), 6) == 0) {
runtest.pass ("Buffer::remove(int, int)");
} else {
runtest.fail ("Buffer::remove(int, int)");
}
delete[] data1;
delete[] data2;
delete[] data3;
}
示例7: Buffer
void
test_read(std::string &filespec)
{
GNASH_REPORT_FUNCTION;
struct stat st;
boost::shared_ptr<Buffer> hex1(new Buffer("00 bf 00 00 01 28 54 43 53 4f 00 04 00 00 00 00 00 08 73 65 74 74 69 6e 67 73 00 00 00 00 00 04 67 61 69 6e 00 40 49 00 00 00 00 00 00 00 00 0f 65 63 68 6f 73 75 70 70 72 65 73 73 69 6f 6e 01 00 00 00 11 64 65 66 61 75 6c 74 6d 69 63 72 6f 70 68 6f 6e 65 02 00 0e 2f 64 65 76 2f 69 6e 70 75 74 2f 6d 69 63 00 00 0d 64 65 66 61 75 6c 74 63 61 6d 65 72 61 02 00 00 00 00 0d 64 65 66 61 75 6c 74 6b 6c 69 6d 69 74 00 40 59 00 00 00 00 00 00 00 00 0d 64 65 66 61 75 6c 74 61 6c 77 61 79 73 01 00 00 00 10 63 72 6f 73 73 64 6f 6d 61 69 6e 41 6c 6c 6f 77 01 01 00 00 11 63 72 6f 73 73 64 6f 6d 61 69 6e 41 6c 77 61 79 73 01 01 00 00 18 61 6c 6c 6f 77 54 68 69 72 64 50 61 72 74 79 4c 53 4f 41 63 63 65 73 73 01 01 00 00 0c 74 72 75 73 74 65 64 50 61 74 68 73 03 00 00 09 00 00 0c 6c 6f 63 61 6c 53 65 63 50 61 74 68 02 00 00 00 00 10 6c 6f 63 61 6c 53 65 63 50 61 74 68 54 69 6d 65 00 42 71 6d 14 10 22 e0 00 00"));
if (stat(filespec.c_str(), &st) == 0) {
SOL sol;
sol.readFile(filespec);
vector<boost::shared_ptr<cygnal::Element> > els = sol.getElements();
if (els.size() > 1) {
string str = els[2]->to_string();
// Make sure multiple elements of varying datatypes are checked for.
if ((strcmp(els[0]->getName(), "gain") == 0) &&
(strcmp(els[2]->getName(), "defaultmicrophone") == 0) &&
(str == "/dev/input/mic") &&
(strcmp(els[5]->getName(), "defaultalways") == 0) &&
(strcmp(els[9]->getName(), "trustedPaths") == 0)) {
runtest.pass("Read SOL File");
} else {
runtest.fail("Read SOL file");
}
} else {
runtest.fail("Read SOL file");
}
// sol.dump();
}
}
示例8: resize
void
test_resize()
{
Buffer buf;
#ifdef HAVE_MALLINFO
if (memdebug) {
mem->addStats(__LINE__); // take a sample
}
#endif
if (buf.size() == cygnal::NETBUFSIZE) {
runtest.pass ("Buffer::size(NETBUFSIZE)");
} else {
runtest.fail ("Buffer::size(NETBUFSIZE)");
}
#ifdef HAVE_MALLINFO
if (memdebug) {
mem->addStats(__LINE__); // take a sample
}
#endif
buf.resize(112);
#ifdef HAVE_MALLINFO
if (memdebug) {
mem->addStats(__LINE__); // take a sample
}
#endif
if (buf.size() == 112) {
runtest.pass ("Buffer::resize(112)");
} else {
runtest.fail ("Buffer::resize(112)");
}
#ifdef HAVE_MALLINFO
if (memdebug) {
mem->addStats(__LINE__); // take a sample
}
#endif
string str = "Hello World";
buf = str;
buf.resize(5);
if (memcmp(buf.begin(), str.c_str(), 5) == 0) {
runtest.pass ("Buffer resize(5)");
} else {
runtest.fail ("Buffer resize(5)");
}
}
示例9:
void
test_int(as_value val)
{
if (val.is_number()) {
runtest.pass("as_value(int)");
} else {
runtest.fail("as_value(int)");
}
}
示例10: Element
void
test_data()
{
LcShm lcs;
// LcShm lcs=LcShm();
char *shmaddr;
const string con1 = "localhost:WeBuildTheseOOOOOOOOOOOOOOOOO";
if (lcs.connect(con1)) {
runtest.pass("LcShm::connect(localhost:lc_reply)");
} else {
runtest.fail("LcShm::connect(localhost:lc_reply)");
}
shmaddr = reinterpret_cast<char*>(lcs.begin()); // for gdb
Element *el;
vector<amf::Element *> els;
#if 0
// Apparently this constructor no longer exists.
el = new Element(true, 123.456, 987.654, "IAmReplyingNow");
// el->dump();
els.push_back(el);
delete el;
#endif
#if 0
//
el = new Element(true);
els.push_back(el);
el = new Element(12.34);
els.push_back(el);
el = new Element(12.34);
els.push_back(el);
string str = "IAmReplyingNow";
el = new Element(str);
els.push_back(el);
#endif
string str = "Volume Level 10 ";
el = new Element(str);
els.push_back(el);
// Send the AMF objects
const std::string localS="localhost";
lcs.send(con1, localS, els);
// system("ipcs");
// system("dumpshm -i");
sleep(3);
delete el;
}
示例11: note
// Each header consists of the following:
//
// * UTF string (including length bytes) - name
// * Boolean - specifies if understanding the header is `required'
// * Long - Length in bytes of header
// * Variable - Actual data (including a type code)
void
test_Header(void){
AMF amf_obj;
amfutf8_t name, headname;
amfnum_t num;
void *element;
amfhead_t *head;
note("Test the Header");
num = 123456789;
char *test = "NumberTest";
name.length = strlen(test);
name.data = test;
element = amf_obj.encodeElement(AMF::NUMBER, &num, 0);
head = amf_obj.encodeHeader(&name, true, sizeof(amfnum_t), &num);
char *ptr = ((char *)head) + 2;
if ((strncmp(ptr, test, name.length) == 0) && (ntohs(*(short *)head) == name.length)) {
runtest.pass("Header name correct");
} else {
runtest.fail("Header name not correct");
}
ptr = ((char *)head) + 2 + name.length + 1;
if (*ptr == AMF::NUMBER) {
runtest.pass("Header Object type correct");
} else {
runtest.fail("Header Object type not correct");
}
ptr++;
if (*ptr == htonl(num)) {
runtest.pass("Header Object data correct");
} else {
runtest.fail("Header Object data not correct");
}
}
示例12:
void
test_find()
{
// Make some data for the buffers
Network::byte_t *data = new Network::byte_t[10];
for (size_t i=0; i<10; i++) {
data[i] = i + 'a';
}
Buffer buf1, buf2, buf3;
Network::byte_t *ptr1 = buf1.reference();
// populate the buffer
buf1.copy(data, 10);
delete[] data;
// See if we can find a character
Network::byte_t *fptr = std::find(buf1.begin(), buf1.end(), 'c');
if (fptr == (ptr1 + 2)) {
runtest.pass ("Buffer::find(Network::byte_t)");
} else {
runtest.fail ("Buffer::find(Network::byte_t)");
}
const char *sub = "fgh";
#if 0
Network::byte_t *ptr2 = const_cast<Network::byte_t *>(reinterpret_cast<const Network::byte_t *>(sub));
#endif
fptr = std::search(buf1.begin(), buf1.end(), sub, sub+3);
if (fptr == (ptr1 + 5)) {
runtest.pass ("Buffer::find(Network::byte_t *, size_t)");
} else {
runtest.fail ("Buffer::find(Network::byte_t *, size_t)");
}
// cygnal::Buffer::init(unsigned int)
}
示例13: open
int
main(int /*argc*/, char** /*argv*/)
{
const char* input = INPUT; // Should be the path to this file
const char* cachename = "NoSeekFileTestCache";
int fd = open(input, O_RDONLY);
int raw = open(input, O_RDONLY);
dup2(fd, 0);
gnash::IOChannel* reader = gnash::noseek_fd_adapter::make_stream(0, cachename);
assert(reader);
compare_reads(reader, raw, "wrapped", "raw");
lseek(raw, 0, SEEK_SET);
reader->seek(0);
compare_reads(reader, raw, "wrapped-rewind", "raw-rewind");
FILE* f = std::fopen(cachename, "r");
std::auto_ptr<gnash::IOChannel> orig = gnash::makeFileChannel(f, false);
lseek(raw, 0, SEEK_SET);
compare_reads(orig.get(), raw, "cache", "raw");
if (sizeof(size_t) != sizeof(std::streamoff)) {
std::streampos pos = std::numeric_limits<size_t>::max();
pos += orig->size() / 2;
// Check that seek() handles integer overflow situations gracefully.
if (orig->seek(pos)) {
runtest.fail("Successfully sought to an invalid position.");
} else {
runtest.pass("Gracefully handled invalid seek.");
}
}
return 0;
}
示例14: ds
void
test_mem()
{
boost::shared_ptr<cygnal::Buffer> buf1(new cygnal::Buffer(12));
*buf1 = "Hello World";
// drop the null terminator byte we inherit when using a simnple
// string for testing
buf1->resize(buf1->size() - 1);
DiskStream ds("fooBar1", *buf1);
ds.writeToDisk();
ds.close();
struct stat st;
memset(&st, 0, sizeof(struct stat));
if (stat("fooBar1", &st) == 0) {
runtest.pass("DiskStream::writeToDisk()");
} else {
runtest.fail("DiskStream::writeToDisk()");
}
}
示例15:
int
main (int /*argc*/, char** /*argv*/) {
CRcInitFile& crc = CRcInitFile::getDefaultInstance();
gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
dbglogfile.setVerbosity();
// Parse the test config file
if (crc.parseFile("cygnalrc")) {
runtest.pass ("crc.parseFile()");
} else {
runtest.fail ("crc.parseFile()");
}
if (crc.useActionDump()) {
runtest.fail ("useActionDump");
} else {
runtest.pass ("useActionDump");
}
if (crc.useParserDump()) {
runtest.fail ("useParserDump");
} else {
runtest.pass ("useParserDump");
}
if (crc.verbosityLevel() == 11) {
runtest.pass ("verbosityLevel");
} else {
runtest.fail ("verbosityLevel");
}
if (crc.getDebugLog() == "/tmp/cygnal-dbg.log") {
runtest.pass ("getDebugLog");
} else {
runtest.fail ("getDebugLog");
}
if (crc.getPortOffset() == 4000) {
runtest.pass ("getPortOffset");
} else {
runtest.fail ("getPortOffset");
}
crc.dump();
}