summaryrefslogtreecommitdiffhomepage
path: root/test/nxt_term_parse_unit_test.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2017-08-30 00:31:02 +0300
committerIgor Sysoev <igor@sysoev.ru>2017-08-30 00:31:02 +0300
commitcdc7e4479ff5aa08df0857a13a7acd7a00b79c89 (patch)
treea57bf9251fc79d9ef7bd3d33b1d05f3813dc3d4a /test/nxt_term_parse_unit_test.c
parent92f3b852981c739a2e6ff6d50dc646fe86031b27 (diff)
downloadunit-cdc7e4479ff5aa08df0857a13a7acd7a00b79c89.tar.gz
unit-cdc7e4479ff5aa08df0857a13a7acd7a00b79c89.tar.bz2
Lib unit tests have been renamed to tests.
Diffstat (limited to 'test/nxt_term_parse_unit_test.c')
-rw-r--r--test/nxt_term_parse_unit_test.c59
1 files changed, 0 insertions, 59 deletions
diff --git a/test/nxt_term_parse_unit_test.c b/test/nxt_term_parse_unit_test.c
deleted file mode 100644
index 818d0e19..00000000
--- a/test/nxt_term_parse_unit_test.c
+++ /dev/null
@@ -1,59 +0,0 @@
-
-/*
- * Copyright (C) Igor Sysoev
- * Copyright (C) NGINX, Inc.
- */
-
-#include <nxt_main.h>
-
-
-typedef struct {
- nxt_str_t string;
- nxt_bool_t is_sec;
- nxt_int_t value;
-} nxt_term_parse_test_t;
-
-
-static const nxt_term_parse_test_t terms[] = {
- { nxt_string("1y"), 1, 365 * 24 * 60 * 60 },
- { nxt_string("1w"), 1, 7 * 24 * 60 * 60 },
- { nxt_string("1w"), 0, 7 * 24 * 60 * 60 * 1000 },
- { nxt_string("1w 1d"), 0, 8 * 24 * 60 * 60 * 1000 },
- { nxt_string("1w d"), 0, -1 },
- { nxt_string("w"), 0, -1 },
- { nxt_string("1d 1w"), 0, -1 },
- { nxt_string("25d"), 0, -2 },
- { nxt_string("300"), 1, 300 },
- { nxt_string("300"), 0, 300000 },
- { nxt_string("300s"), 1, 300 },
- { nxt_string("300ms"), 0, 300 },
- { nxt_string("1y 1M 1w1d1h1m1s"), 1,
- (((((365 + 30 + 7 + 1) * 24 + 1) * 60) + 1) * 60) + 1 },
-};
-
-
-nxt_int_t
-nxt_term_parse_unit_test(nxt_thread_t *thr)
-{
- nxt_int_t val;
- nxt_uint_t i;
- const nxt_str_t *s;
-
- nxt_thread_time_update(thr);
-
- for (i = 0; i < nxt_nitems(terms); i++) {
-
- s = &terms[i].string;
- val = nxt_term_parse(s->start, s->length, terms[i].is_sec);
-
- if (val != terms[i].value) {
- nxt_log_alert(thr->log,
- "term parse unit test failed: \"%V\": %i %i",
- s, terms[i].value, val);
- return NXT_ERROR;
- }
- }
-
- nxt_log_error(NXT_LOG_NOTICE, thr->log, "term parse unit test passed");
- return NXT_OK;
-}