use nix build & meson & zlog
This commit is contained in:
parent
0123623742
commit
346768a144
60 changed files with 13739 additions and 0 deletions
44
src/lib/testsuite/test_error.c
Normal file
44
src/lib/testsuite/test_error.c
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "xce/errnox.h"
|
||||
#include "unity.h"
|
||||
#include "utils.h"
|
||||
|
||||
static void test_error_setget(void) {
|
||||
int myerrno =1;
|
||||
ectx_t *e;
|
||||
|
||||
SET_ERROR(myerrno);
|
||||
e = get_ectx();
|
||||
|
||||
TEST_ASSERT_TRUE(e != NULL);
|
||||
TEST_ASSERT_TRUE(errno == myerrno);
|
||||
TEST_ASSERT_TRUE(e->file != NULL);
|
||||
TEST_ASSERT_TRUE(e->func != NULL);
|
||||
TEST_ASSERT_TRUE(strcmp(e->file, __FILE__) == 0);
|
||||
TEST_ASSERT_TRUE(strcmp(e->func, __func__) == 0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void test_strerror_r(void) {
|
||||
char errmsg1[256];
|
||||
char errmsg2[256];
|
||||
int errors[] ={ENOENT, EINVAL, E_XCE_BAD_JOB, E_XCE_BAD_WORKER, 0};
|
||||
int i;
|
||||
|
||||
for(i = 0; errors[i] != 0; i ++) {
|
||||
strerror_r(errors[i], errmsg1, sizeof(errmsg1));
|
||||
xce_strerror_r(errors[i], errmsg2, sizeof(errmsg2));
|
||||
TEST_ASSERT_TRUE(strcmp(errmsg1, errmsg2) == 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
void test_error(void) {
|
||||
printf("\n>> error test\n\n");
|
||||
|
||||
RUN_TEST(test_error_setget);
|
||||
#if 0
|
||||
RUN_TEST(test_strerror_r);
|
||||
#endif
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue