本文整理汇总了C++中ASSERT_INT_EQ函数的典型用法代码示例。如果您正苦于以下问题:C++ ASSERT_INT_EQ函数的具体用法?C++ ASSERT_INT_EQ怎么用?C++ ASSERT_INT_EQ使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ASSERT_INT_EQ函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: sig_fuzz
static void
sig_fuzz(struct sshkey *k, const char *sig_alg)
{
struct fuzz *fuzz;
u_char *sig, c[] = "some junk to be signed";
size_t l;
u_int fuzzers = FUZZ_1_BIT_FLIP | FUZZ_1_BYTE_FLIP | FUZZ_2_BYTE_FLIP |
FUZZ_TRUNCATE_START | FUZZ_TRUNCATE_END;
if (test_is_fast())
fuzzers &= ~FUZZ_2_BYTE_FLIP;
if (test_is_slow())
fuzzers |= FUZZ_2_BIT_FLIP;
ASSERT_INT_EQ(sshkey_sign(k, &sig, &l, c, sizeof(c), sig_alg, 0), 0);
ASSERT_SIZE_T_GT(l, 0);
fuzz = fuzz_begin(fuzzers, sig, l);
ASSERT_INT_EQ(sshkey_verify(k, sig, l, c, sizeof(c), NULL, 0), 0);
free(sig);
TEST_ONERROR(onerror, fuzz);
for(; !fuzz_done(fuzz); fuzz_next(fuzz)) {
/* Ensure 1-bit difference at least */
if (fuzz_matches_original(fuzz))
continue;
ASSERT_INT_NE(sshkey_verify(k, fuzz_ptr(fuzz), fuzz_len(fuzz),
c, sizeof(c), NULL, 0), 0);
}
fuzz_cleanup(fuzz);
}
开发者ID:nkadel,项目名称:nkadel-openssh-portable,代码行数:29,代码来源:test_fuzz.c
示例2: test_ensure
static void
test_ensure(void)
{
struct sol_buffer buf = SOL_BUFFER_INIT_EMPTY;
const int size = 1024;
char *buf_data;
int i;
sol_buffer_ensure(&buf, size);
memset(buf.data, 22, size);
sol_buffer_ensure(&buf, size * 2);
buf_data = buf.data;
for (i = 0; i < size; i++) {
ASSERT_INT_EQ(buf_data[i], 22);
}
sol_buffer_ensure(&buf, size / 2);
buf_data = buf.data;
for (i = 0; i < size / 2; i++) {
ASSERT_INT_EQ(buf_data[i], 22);
}
sol_buffer_fini(&buf);
}
开发者ID:Achint08,项目名称:soletta,代码行数:26,代码来源:test-buffer.c
示例3: munch
static void
munch(int fd, enum ev_type ev, void *arg)
{
ssize_t nbytes;
char buf[32] = { 0 };
int err;
if ((nbytes = read(fd, buf, sizeof (buf))) < 0) {
FAIL_ERRNO("bad read");
}
VERBOSE(("read %ld bytes '%s'", nbytes, buf));
err = mevent_disable(read_event);
ASSERT_INT_EQ(("mevent_disable: ", strerror(err)), err, 0);
pthread_mutex_lock(&mtx);
ASSERT_INT_EQ(("wrong lastwake"), lastwake, CB_NONE);
lastwake = CB_READ;
pthread_cond_signal(&cv);
VERBOSE(("wakeup"));
pthread_mutex_unlock(&mtx);
}
开发者ID:joyent,项目名称:illumos-joyent,代码行数:25,代码来源:read.disable.c
示例4: test_append_from_base64
static void
test_append_from_base64(void)
{
struct sol_buffer buf;
struct sol_str_slice slice;
const char to_decode[] = "VGhpcyBpcyBhIG1lc3NhZ2UgdGhhdCBpcyBtdWx0aXBsZSBvZiAzIGNoYXJz";
int err;
#define B64_DECODED "This is a message that is multiple of 3 chars"
sol_buffer_init(&buf);
slice = sol_str_slice_from_str("XYZ");
err = sol_buffer_append_slice(&buf, slice);
ASSERT_INT_EQ(err, 0);
ASSERT_INT_EQ(buf.used, strlen("XYZ"));
ASSERT_STR_EQ(buf.data, "XYZ");
slice = sol_str_slice_from_str(to_decode);
err = sol_buffer_append_from_base64(&buf, slice, SOL_BASE64_MAP);
ASSERT_INT_EQ(err, 0);
ASSERT_INT_EQ(buf.used, strlen("XYZ" B64_DECODED));
ASSERT_STR_EQ(buf.data, "XYZ" B64_DECODED);
sol_buffer_fini(&buf);
#undef B64_DECODED
}
开发者ID:Achint08,项目名称:soletta,代码行数:27,代码来源:test-buffer.c
示例5: test_append_from_base16
static void
test_append_from_base16(void)
{
struct sol_buffer buf;
struct sol_str_slice slice;
const char to_decode[] = "546573742001090a0f2048656c6c6f";
int err;
#define B16_DECODED "Test \x01\x09\x0a\x0f Hello"
sol_buffer_init(&buf);
slice = sol_str_slice_from_str("XYZ");
err = sol_buffer_append_slice(&buf, slice);
ASSERT_INT_EQ(err, 0);
ASSERT_INT_EQ(buf.used, strlen("XYZ"));
ASSERT_STR_EQ(buf.data, "XYZ");
slice = sol_str_slice_from_str(to_decode);
err = sol_buffer_append_from_base16(&buf, slice, SOL_DECODE_LOWERCASE);
ASSERT_INT_EQ(err, 0);
ASSERT_INT_EQ(buf.used, strlen("XYZ" B16_DECODED));
ASSERT_STR_EQ(buf.data, "XYZ" B16_DECODED);
sol_buffer_fini(&buf);
#undef B16_DECODED
}
开发者ID:Achint08,项目名称:soletta,代码行数:27,代码来源:test-buffer.c
示例6: public_fuzz
static void
public_fuzz(struct sshkey *k)
{
struct sshkey *k1;
struct sshbuf *buf;
struct fuzz *fuzz;
ASSERT_PTR_NE(buf = sshbuf_new(), NULL);
ASSERT_INT_EQ(sshkey_to_blob_buf(k, buf), 0);
/* XXX need a way to run the tests in "slow, but complete" mode */
fuzz = fuzz_begin(FUZZ_1_BIT_FLIP | /* XXX too slow FUZZ_2_BIT_FLIP | */
FUZZ_1_BYTE_FLIP | /* XXX too slow FUZZ_2_BYTE_FLIP | */
FUZZ_TRUNCATE_START | FUZZ_TRUNCATE_END,
sshbuf_mutable_ptr(buf), sshbuf_len(buf));
ASSERT_INT_EQ(sshkey_from_blob(sshbuf_ptr(buf), sshbuf_len(buf),
&k1), 0);
sshkey_free(k1);
sshbuf_free(buf);
TEST_ONERROR(onerror, fuzz);
for(; !fuzz_done(fuzz); fuzz_next(fuzz)) {
if (sshkey_from_blob(fuzz_ptr(fuzz), fuzz_len(fuzz), &k1) == 0)
sshkey_free(k1);
}
fuzz_cleanup(fuzz);
}
开发者ID:gdestuynder,项目名称:openssh-portable,代码行数:25,代码来源:test_fuzz.c
示例7: test_no_nul_byte
static void
test_no_nul_byte(void)
{
struct sol_buffer buf;
int32_t backend;
int32_t value = 0xdeadbeef;
int err;
sol_buffer_init_flags(&buf, &backend, sizeof(backend),
SOL_BUFFER_FLAGS_MEMORY_NOT_OWNED | SOL_BUFFER_FLAGS_NO_NUL_BYTE);
err = sol_buffer_ensure(&buf, sizeof(int32_t));
ASSERT_INT_EQ(err, 0);
err = sol_buffer_append_slice(&buf, SOL_STR_SLICE_STR((const char *)&value, sizeof(value)));
ASSERT_INT_EQ(err, 0);
err = sol_buffer_append_slice(&buf, SOL_STR_SLICE_STR((const char *)&value, sizeof(value)));
ASSERT_INT_NE(err, 0);
sol_buffer_fini(&buf);
sol_buffer_init_flags(&buf, NULL, 0, SOL_BUFFER_FLAGS_NO_NUL_BYTE);
err = sol_buffer_append_printf(&buf, "123");
ASSERT_INT_EQ(err, 0);
err = sol_buffer_append_printf(&buf, "4");
ASSERT_INT_EQ(err, 0);
ASSERT(sol_str_slice_eq(sol_buffer_get_slice(&buf),
SOL_STR_SLICE_STR("1234", 4)));
sol_buffer_fini(&buf);
}
开发者ID:Achint08,项目名称:soletta,代码行数:32,代码来源:test-buffer.c
示例8: test_s2k
void
test_s2k(void)
{
TEST_START("s2k");
static unsigned char salt[S2K_SALT_BYTES] = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 };
const char * pphrase = "ImGumbyAndYouAreNot";
static unsigned char expected_key1[AES128_KEY_BYTES] = {
0x0e, 0xa5, 0x00, 0x1c, 0xce, 0xad, 0x7e, 0xa8, 0xa0, 0x81, 0x38, 0xae, 0xaf, 0x4e, 0x28, 0xd5
};
unsigned char s2k_key1[AES128_KEY_BYTES];
compute_gpg_s2k_key(pphrase, sizeof(s2k_key1), salt, S2K_ITER_BYTE_COUNT, s2k_key1);
ASSERT_INT_EQ(memcmp(s2k_key1, expected_key1, sizeof(s2k_key1)), 0);
// Second test to handle the case where we need to run multiple hashes to generate enough bits
// Note that the first 16 bytes are the same as the previous test - this is to be expected, since the
// salt and passphrase are the same, so the first hash is executed identically.
static unsigned char expected_key2[48] = {
0x0e, 0xa5, 0x00, 0x1c, 0xce, 0xad, 0x7e, 0xa8, 0xa0, 0x81, 0x38, 0xae, 0xaf, 0x4e, 0x28, 0xd5,
0x21, 0xf1, 0xee, 0x4b, 0x02, 0xc0, 0x0f, 0x63, 0x6a, 0x17, 0xbf, 0x62, 0x34, 0x10, 0x26, 0x48,
0x7b, 0xc6, 0x3f, 0x08, 0x9d, 0xb5, 0x6b, 0x34, 0x70, 0x3b, 0x71, 0xdb, 0x67, 0x92, 0x6f, 0x5f
};
unsigned char s2k_key2[48];
compute_gpg_s2k_key(pphrase, sizeof(s2k_key2), salt, S2K_ITER_BYTE_COUNT, s2k_key2);
ASSERT_INT_EQ(memcmp(s2k_key2, expected_key2, sizeof(s2k_key2)), 0);
TEST_DONE();
}
开发者ID:BobWall23,项目名称:ironssh,代码行数:31,代码来源:test_gpg-key.c
示例9: test_coap_parse_empty_pdu
static void
test_coap_parse_empty_pdu(void)
{
uint8_t pdu[] = { 0x40, 0x01, 0, 0 };
struct sol_coap_packet *pkt;
struct sol_buffer *buf;
size_t offset;
uint8_t ver, type, code;
uint16_t id;
pkt = sol_coap_packet_new(NULL);
ASSERT(pkt);
ASSERT(!sol_coap_packet_get_payload(pkt, &buf, &offset));
ASSERT(!sol_buffer_remove_data(buf, 0, offset));
ASSERT(!sol_buffer_insert_bytes(buf, 0, pdu, sizeof(pdu)));
ASSERT(!coap_packet_parse(pkt));
sol_coap_header_get_version(pkt, &ver);
sol_coap_header_get_type(pkt, &type);
sol_coap_header_get_code(pkt, &code);
sol_coap_header_get_id(pkt, &id);
ASSERT_INT_EQ(ver, 1);
ASSERT_INT_EQ(type, SOL_COAP_MESSAGE_TYPE_CON);
ASSERT_INT_EQ(code, SOL_COAP_METHOD_GET);
ASSERT_INT_EQ(id, 0);
sol_coap_packet_unref(pkt);
}
开发者ID:brunobottazzini,项目名称:soletta,代码行数:31,代码来源:test-coap.c
示例10: test_coap_find_options
static void
test_coap_find_options(void)
{
uint8_t pdu[] = { 0x55, 0xA5, 0x12, 0x34, 't', 'o', 'k', 'e', 'n',
0x00, 0xC1, 0x00, 0xff, 'p', 'a', 'y', 'l', 'o', 'a', 'd', 0x00 };
struct sol_str_slice options[16];
struct sol_coap_packet *pkt;
struct sol_buffer *buf;
int count = 16;
size_t offset;
pkt = sol_coap_packet_new(NULL);
ASSERT(pkt);
ASSERT(!sol_coap_packet_get_payload(pkt, &buf, &offset));
ASSERT(!sol_buffer_remove_data(buf, 0, offset));
ASSERT(!sol_buffer_insert_bytes(buf, 0, pdu, sizeof(pdu)));
ASSERT(!coap_packet_parse(pkt));
count = sol_coap_find_options(pkt, SOL_COAP_OPTION_CONTENT_FORMAT, options, count);
ASSERT_INT_EQ(count, 1);
ASSERT_INT_EQ(options[0].len, 1);
ASSERT_INT_EQ((uint8_t)options[0].data[0], 0);
count = sol_coap_find_options(pkt, SOL_COAP_OPTION_IF_MATCH, options, count);
ASSERT_INT_EQ(count, 0);
sol_coap_packet_unref(pkt);
}
开发者ID:brunobottazzini,项目名称:soletta,代码行数:30,代码来源:test-coap.c
示例11: TEST_MAINLOOP_MAIN_FN
int
TEST_MAINLOOP_MAIN_FN(int argc, char *argv[])
{
int err, i;
struct sol_timeout *timeout_to_del;
struct sol_idle *idler_to_del;
err = sol_init();
ASSERT(!err);
timeout_to_del = sol_timeout_add(100, timeout_never_called, NULL);
sol_timeout_add(20, on_timeout_del_and_new, timeout_to_del);
sol_timeout_add(1, on_timeout_renew_twice, NULL);
sol_idle_add(on_idler_renew_twice, NULL);
for (i = 0; i < 5; i++)
sol_idle_add(on_idler, (void *)(intptr_t)i);
sol_idle_add(on_idler_del_another, &idler_to_del);
idler_to_del = sol_idle_add(on_idler_never_called, NULL);
sol_run();
ASSERT_INT_EQ(timeout_called, 3);
ASSERT_INT_EQ(timeout_renewed, 2);
ASSERT_INT_EQ(idler_renewed, 2);
for (i = 0; i < 10; i++)
ASSERT_INT_EQ(idler_sequence[i], i);
sol_shutdown();
return 0;
}
开发者ID:Achint08,项目名称:soletta,代码行数:34,代码来源:test-mainloop.c
示例12: test_base64_encode
static void
test_base64_encode(void)
{
const char base64_map[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
const char instr[] = "This is a message that is multiple of 3 chars";
const char *expectstrs[] = {
"VGhpcyBpcyBhIG1lc3NhZ2UgdGhhdCBpcyBtdWx0aXBsZSBvZiAzIGNoYXJz",
"VGhpcyBpcyBhIG1lc3NhZ2UgdGhhdCBpcyBtdWx0aXBsZSBvZiAzIGNoYXI=",
"VGhpcyBpcyBhIG1lc3NhZ2UgdGhhdCBpcyBtdWx0aXBsZSBvZiAzIGNoYQ==",
"VGhpcyBpcyBhIG1lc3NhZ2UgdGhhdCBpcyBtdWx0aXBsZSBvZiAzIGNo"
};
struct sol_str_slice slice;
char outstr[(sizeof(instr) / 3 + 1) * 4 + 1];
size_t r, i;
slice = sol_str_slice_from_str(instr);
for (i = 0; i < SOL_UTIL_ARRAY_SIZE(expectstrs); i++) {
struct sol_str_slice exp = sol_str_slice_from_str(expectstrs[i]);
memset(outstr, 0xff, sizeof(outstr));
r = sol_util_base64_encode(outstr, sizeof(outstr), slice, base64_map);
ASSERT_INT_EQ(r, exp.len);
ASSERT_INT_EQ(outstr[r], (char)0xff);
outstr[r] = '\0';
ASSERT_STR_EQ(outstr, exp.data);
slice.len--;
}
}
开发者ID:cmarcelo,项目名称:soletta,代码行数:30,代码来源:test-util.c
示例13: public_fuzz
static void
public_fuzz(struct sshkey *k)
{
struct sshkey *k1;
struct sshbuf *buf;
struct fuzz *fuzz;
u_int fuzzers = FUZZ_1_BIT_FLIP | FUZZ_1_BYTE_FLIP |
FUZZ_TRUNCATE_START | FUZZ_TRUNCATE_END;
if (test_is_fast())
fuzzers &= ~FUZZ_1_BIT_FLIP;
if (test_is_slow())
fuzzers |= FUZZ_2_BIT_FLIP | FUZZ_2_BYTE_FLIP;
ASSERT_PTR_NE(buf = sshbuf_new(), NULL);
ASSERT_INT_EQ(sshkey_putb(k, buf), 0);
fuzz = fuzz_begin(fuzzers, sshbuf_mutable_ptr(buf), sshbuf_len(buf));
ASSERT_INT_EQ(sshkey_from_blob(sshbuf_ptr(buf), sshbuf_len(buf),
&k1), 0);
sshkey_free(k1);
sshbuf_free(buf);
TEST_ONERROR(onerror, fuzz);
for(; !fuzz_done(fuzz); fuzz_next(fuzz)) {
if (sshkey_from_blob(fuzz_ptr(fuzz), fuzz_len(fuzz), &k1) == 0)
sshkey_free(k1);
}
fuzz_cleanup(fuzz);
}
开发者ID:nkadel,项目名称:nkadel-openssh-portable,代码行数:27,代码来源:test_fuzz.c
示例14: test_coap_find_options
static void
test_coap_find_options(void)
{
uint8_t pdu[] = { 0x55, 0xA5, 0x12, 0x34, 't', 'o', 'k', 'e', 'n',
0x00, 0xC1, 0x00, 0xff, 'p', 'a', 'y', 'l', 'o', 'a', 'd', 0x00 };
struct sol_coap_packet *pkt;
struct sol_str_slice options[16];
int count = 16;
pkt = sol_coap_packet_new(NULL);
ASSERT(pkt);
memcpy(pkt->buf, pdu, sizeof(pdu));
pkt->payload.size = sizeof(pdu);
ASSERT(!coap_packet_parse(pkt));
count = sol_coap_find_options(pkt, SOL_COAP_OPTION_CONTENT_FORMAT, options, count);
ASSERT_INT_EQ(count, 1);
ASSERT_INT_EQ(options[0].len, 1);
ASSERT_INT_EQ((uint8_t)options[0].data[0], 0);
count = sol_coap_find_options(pkt, SOL_COAP_OPTION_IF_MATCH, options, count);
ASSERT_INT_EQ(count, 0);
sol_coap_packet_unref(pkt);
}
开发者ID:NilayNigam,项目名称:soletta,代码行数:27,代码来源:test-coap.c
示例15: test_coap_parse_simple_pdu
static void
test_coap_parse_simple_pdu(void)
{
uint8_t pdu[] = { 0x55, 0xA5, 0x12, 0x34, 't', 'o', 'k', 'e',
'n', 0x00, 0xc1, 0x00, 0xff, 'p', 'a', 'y',
'l', 'o', 'a', 'd', 0x00 };
struct sol_str_slice options[16];
struct sol_coap_packet *pkt;
struct sol_buffer *buf;
uint8_t *token;
int count = 16;
size_t offset;
uint8_t tkl, code, ver, type;
uint16_t id;
pkt = sol_coap_packet_new(NULL);
ASSERT(pkt);
ASSERT(!sol_coap_packet_get_payload(pkt, &buf, &offset));
ASSERT(!sol_buffer_remove_data(buf, 0, offset));
ASSERT(!sol_buffer_insert_bytes(buf, 0, pdu, sizeof(pdu)));
ASSERT(!coap_packet_parse(pkt));
sol_coap_header_get_version(pkt, &ver);
sol_coap_header_get_type(pkt, &type);
ASSERT_INT_EQ(ver, 1);
ASSERT_INT_EQ(type, SOL_COAP_MESSAGE_TYPE_NON_CON);
token = sol_coap_header_get_token(pkt, &tkl);
ASSERT(token);
ASSERT_INT_EQ(tkl, 5);
ASSERT(!strcmp((char *)token, "token"));
sol_coap_header_get_code(pkt, &code);
sol_coap_header_get_id(pkt, &id);
ASSERT_INT_EQ(code, SOL_COAP_RESPONSE_CODE_PROXYING_NOT_SUPPORTED);
ASSERT_INT_EQ(id, 0x1234);
count = sol_coap_find_options(pkt, SOL_COAP_OPTION_CONTENT_FORMAT, options, count);
ASSERT_INT_EQ(count, 1);
ASSERT_INT_EQ(options[0].len, 1);
ASSERT_INT_EQ((uint8_t)options[0].data[0], 0);
/* Not existent. */
count = sol_coap_find_options(pkt, SOL_COAP_OPTION_ETAG, options, count);
ASSERT_INT_EQ(count, 0);
ASSERT(!sol_coap_packet_get_payload(pkt, &buf, &offset));
ASSERT_INT_EQ(offset + sizeof("payload"), buf->used);
ASSERT(!strcmp((char *)buf->data + offset, "payload"));
sol_coap_packet_unref(pkt);
}
开发者ID:brunobottazzini,项目名称:soletta,代码行数:55,代码来源:test-coap.c
示例16: TestQPSyntax_run_tests
void
TestQPSyntax_run_tests(Folder *index)
{
u32_t i;
TestBatch *batch = Test_new_batch("TestQueryParserSyntax", 48, NULL);
Searcher *searcher = Searcher_new((Obj*)index);
QueryParser *qparser = QParser_new(Searcher_Get_Schema(searcher),
NULL, NULL, NULL);
QParser_Set_Heed_Colons(qparser, true);
PLAN(batch);
for (i = 0; leaf_test_funcs[i] != NULL; i++) {
kino_TestQPSyntax_test_t test_func = leaf_test_funcs[i];
TestQueryParser *test_case = test_func(i);
Query *tree = QParser_Tree(qparser, test_case->query_string);
Query *expanded = QParser_Expand_Leaf(qparser, test_case->tree);
Query *parsed = QParser_Parse(qparser, test_case->query_string);
Hits *hits = Searcher_Hits(searcher, (Obj*)parsed, 0, 10, NULL);
ASSERT_TRUE(batch, Query_Equals(tree, (Obj*)test_case->tree),
"tree() %s", test_case->query_string->ptr);
ASSERT_TRUE(batch, Query_Equals(expanded, (Obj*)test_case->expanded),
"expand_leaf() %s", test_case->query_string->ptr);
ASSERT_INT_EQ(batch, Hits_Total_Hits(hits), test_case->num_hits,
"hits: %s", test_case->query_string->ptr);
DECREF(hits);
DECREF(parsed);
DECREF(expanded);
DECREF(tree);
DECREF(test_case);
}
for (i = 0; syntax_test_funcs[i] != NULL; i++) {
kino_TestQPSyntax_test_t test_func = syntax_test_funcs[i];
TestQueryParser *test_case = test_func(i);
Query *tree = QParser_Tree(qparser, test_case->query_string);
Query *parsed = QParser_Parse(qparser, test_case->query_string);
Hits *hits = Searcher_Hits(searcher, (Obj*)parsed, 0, 10, NULL);
ASSERT_TRUE(batch, Query_Equals(tree, (Obj*)test_case->tree),
"tree() %s", test_case->query_string->ptr);
ASSERT_INT_EQ(batch, Hits_Total_Hits(hits), test_case->num_hits,
"hits: %s", test_case->query_string->ptr);
DECREF(hits);
DECREF(parsed);
DECREF(tree);
DECREF(test_case);
}
batch->destroy(batch);
DECREF(searcher);
DECREF(qparser);
}
开发者ID:robertkrimen,项目名称:Search-Kino03,代码行数:54,代码来源:TestQueryParserSyntax.c
示例17: test_size_mul
static void
test_size_mul(void)
{
const size_t half_size = SIZE_MAX / 2;
const size_t half_double_size = (SIZE_MAX % 2) ? (SIZE_MAX - 1) : SIZE_MAX;
size_t out;
ASSERT(sol_util_size_mul(half_size, 2, &out) == 0);
ASSERT_INT_EQ(out, half_double_size);
ASSERT_INT_EQ(sol_util_size_mul(half_size, 4, &out), -EOVERFLOW);
}
开发者ID:cmarcelo,项目名称:soletta,代码行数:12,代码来源:test-util.c
示例18: put_opt
static void
put_opt(struct sshbuf *b, const char *name, const char *value)
{
struct sshbuf *sect;
sect = sshbuf_new();
ASSERT_PTR_NE(sect, NULL);
ASSERT_INT_EQ(sshbuf_put_cstring(b, name), 0);
if (value != NULL)
ASSERT_INT_EQ(sshbuf_put_cstring(sect, value), 0);
ASSERT_INT_EQ(sshbuf_put_stringb(b, sect), 0);
sshbuf_free(sect);
}
开发者ID:1174533476,项目名称:Win32-OpenSSH,代码行数:13,代码来源:test_sshkey.c
示例19: badarg
void
badarg(void)
{
char buf[16];
int len, width;
width = 1;
TEST_START("utf8_badarg");
len = snmprintf(buf, sizeof(buf), &width, "\377");
ASSERT_INT_EQ(len, -1);
ASSERT_STRING_EQ(buf, "");
ASSERT_INT_EQ(width, 0);
TEST_DONE();
}
开发者ID:BobWall23,项目名称:ironssh,代码行数:14,代码来源:tests.c
示例20: test_check_slices_after_adding_all
static void
test_check_slices_after_adding_all(void)
{
static const char *gladiators[] = { "Spartacus", "C r i x u s", "Priscus and Verus", "Tetraites",
"Spiculus", "Marcus Attilius", "Carpophorus", "Flamma", "Commodus", "Mevia", "Hoplomachus",
"Laquearius", "Lorarius", "Paegniarius", "Sagittarius", "Pegasasu no Seiya", "Thraex", "Gladiatrix",
"Crupellarii", "Cestus", "Arbelas", "Retiarius", "Samnite", "Venator", "Dimachaerus", "Bustuarius",
"This is a loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong name for a gladiator"
};
struct sol_arena *arena;
struct sol_str_slice results[sol_util_array_size(gladiators)];
unsigned int i;
arena = sol_arena_new();
ASSERT(arena);
for (i = 0; i < sol_util_array_size(gladiators); i++)
ASSERT_INT_EQ(sol_arena_slice_dup_str(arena, &results[i], gladiators[i]), 0);
for (i = 0; i < sol_util_array_size(gladiators); i++)
ASSERT(sol_str_slice_eq(results[i], sol_str_slice_from_str(gladiators[i])));
sol_arena_del(arena);
}
开发者ID:cabelitos,项目名称:soletta,代码行数:25,代码来源:test-arena.c
注:本文中的ASSERT_INT_EQ函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论