summaryrefslogtreecommitdiff
path: root/TC/unit
diff options
context:
space:
mode:
Diffstat (limited to 'TC/unit')
-rw-r--r--TC/unit/Makefile23
-rw-r--r--TC/unit/tslist2
-rw-r--r--TC/unit/utc_ApplicationFW___dlog_print_func.c66
-rw-r--r--TC/unit/utc_ApplicationFW___dlog_vprint_func.c76
4 files changed, 167 insertions, 0 deletions
diff --git a/TC/unit/Makefile b/TC/unit/Makefile
new file mode 100644
index 0000000..7be4c17
--- /dev/null
+++ b/TC/unit/Makefile
@@ -0,0 +1,23 @@
+CC ?= gcc
+
+TARGETS = utc_ApplicationFW___dlog_print_func \
+ utc_ApplicationFW___dlog_vprint_func
+
+PKGS = dlog
+
+LDFLAGS = `pkg-config --libs $(PKGS)`
+LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s
+
+CFLAGS = -I. `pkg-config --cflags $(PKGS)`
+CFLAGS += -I$(TET_ROOT)/inc/tet3
+CFLAGS += -Wall
+
+all: $(TARGETS)
+
+$(TARGETS): %: %.c
+ $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
+
+clean:
+ rm -f $(TARGETS)
diff --git a/TC/unit/tslist b/TC/unit/tslist
new file mode 100644
index 0000000..0d9e63d
--- /dev/null
+++ b/TC/unit/tslist
@@ -0,0 +1,2 @@
+/unit/utc_ApplicationFW___dlog_print_func
+/unit/utc_ApplicationFW___dlog_vprint_func
diff --git a/TC/unit/utc_ApplicationFW___dlog_print_func.c b/TC/unit/utc_ApplicationFW___dlog_print_func.c
new file mode 100644
index 0000000..589c4f9
--- /dev/null
+++ b/TC/unit/utc_ApplicationFW___dlog_print_func.c
@@ -0,0 +1,66 @@
+#include <tet_api.h>
+#include "dlog.h"
+#define LOG_BUF_SIZE 1024
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW___dlog_print_func_01(void);
+static void utc_ApplicationFW___dlog_print_func_02(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ { utc_ApplicationFW___dlog_print_func_01, POSITIVE_TC_IDX },
+ { utc_ApplicationFW___dlog_print_func_02, NEGATIVE_TC_IDX },
+ { NULL, 0 }
+};
+
+//static int pid;
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of __dlog_print()
+ */
+static void utc_ApplicationFW___dlog_print_func_01(void)
+{
+ int r = 0;
+
+ r = __dlog_print(LOG_ID_MAIN, DLOG_DEBUG,"DLOG_TEST", "dlog test message for tetware\n");
+
+ if (r<0) {
+ tet_printf("__dlog_print() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init __dlog_print()
+ */
+static void utc_ApplicationFW___dlog_print_func_02(void)
+{
+ int r = 0;
+
+ r = __dlog_print( LOG_ID_MAX , DLOG_DEBUG,"DLOG_TEST", "dlog test message for tetware\n");
+
+ if (r>=0) {
+ tet_printf("__dlog_print() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW___dlog_vprint_func.c b/TC/unit/utc_ApplicationFW___dlog_vprint_func.c
new file mode 100644
index 0000000..9e4a30b
--- /dev/null
+++ b/TC/unit/utc_ApplicationFW___dlog_vprint_func.c
@@ -0,0 +1,76 @@
+#include <stdarg.h>
+#include <tet_api.h>
+#include "dlog.h"
+#define LOG_BUF_SIZE 1024
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW___dlog_vprint_func_01(void);
+static void utc_ApplicationFW___dlog_vprint_func_02(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ { utc_ApplicationFW___dlog_vprint_func_01, POSITIVE_TC_IDX },
+ { utc_ApplicationFW___dlog_vprint_func_02, NEGATIVE_TC_IDX },
+ { NULL, 0 }
+};
+
+static int pid;
+char *fmt = "dlog test message for tetware\n";
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+/**
+ * @brief Positive test case of __dlog_vprint()
+ */
+void utc_ApplicationFW___dlog_vprint_func_01(void)
+{
+ int r = 0;
+ char buf[LOG_BUF_SIZE];
+ va_list ap;
+
+ /* va_start(ap, fmt);*/
+
+ r = __dlog_vprint(LOG_ID_MAIN, DLOG_DEBUG, "DLOG_TEST", buf, ap );
+ /* va_end(ap);*/
+
+ if (r<0) {
+ tet_printf("__dlog_vprint() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init __dlog_vprint()
+ */
+void utc_ApplicationFW___dlog_vprint_func_02(void)
+{
+ int r = 0;
+ char buf[LOG_BUF_SIZE];
+ va_list ap;
+// va_start(ap, fmt);
+
+ r = __dlog_vprint(LOG_ID_MAX, DLOG_DEBUG,"DLOG_TEST", fmt, ap );
+// va_end(ap);
+
+ if (r>=0) {
+ tet_printf("__dlog_vprint() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}