From f4bb3204702e9f1b50debf2c56df9441e23d69ae Mon Sep 17 00:00:00 2001 From: c9s Date: Sun, 18 May 2014 14:18:47 +0800 Subject: [PATCH] Add one more pcre test --- Makefile.in | 10 ++++++++++ tests/Makefile.in | 17 +++++++++++++++-- tests/bench_str.csv | 2 ++ tests/check_tree.c | 10 +++++----- 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/Makefile.in b/Makefile.in index 7562e83..c44255c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -364,6 +364,16 @@ r3_include_HEADERS = \ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = r3.pc +EXTRA_DIST = \ + autogen.sh \ + bench.html \ + demo.c \ + gen_routes.rb \ + HACKING.md \ + LICENSE \ + README.md \ + $(NULL) + all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive diff --git a/tests/Makefile.in b/tests/Makefile.in index ae0f17d..dfeffda 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -13,6 +13,8 @@ # PARTICULAR PURPOSE. @SET_MAKE@ + + VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ @@ -83,7 +85,8 @@ TESTS = check_tree$(EXEEXT) $(am__EXEEXT_1) check_PROGRAMS = $(am__EXEEXT_2) subdir = tests DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp $(top_srcdir)/test-driver + $(top_srcdir)/depcomp $(dist_noinst_DATA) $(noinst_HEADERS) \ + $(top_srcdir)/test-driver ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ @@ -160,6 +163,8 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +DATA = $(dist_noinst_DATA) +HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is @@ -509,6 +514,14 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = $(DEPS_CFLAGS) -I$(top_builddir) -I$(top_builddir)/include \ @CHECK_CFLAGS@ $(am__append_2) +noinst_HEADERS = \ + bench.h \ + $(NULL) + +dist_noinst_DATA = \ + bench_str.csv \ + $(NULL) + @ENABLE_GRAPHVIZ_TRUE@check_gvc_SOURCES = check_gvc.c bench.c @ENABLE_GRAPHVIZ_TRUE@check_gvc_LDADD = $(GVC_DEPS_LIBS) $(DEPS_LIBS) -L$(top_builddir)/src -lr3 @CHECK_LIBS@ @ENABLE_GRAPHVIZ_TRUE@check_gvc_CFLAGS = $(GVC_DEPS_CFLAGS) $(DEPS_CFLAGS) -I$(top_builddir) -I$(top_builddir)/include @CHECK_CFLAGS@ @@ -923,7 +936,7 @@ check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am -all-am: Makefile +all-am: Makefile $(DATA) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am diff --git a/tests/bench_str.csv b/tests/bench_str.csv index 9ae7a65..62713f7 100644 --- a/tests/bench_str.csv +++ b/tests/bench_str.csv @@ -155,3 +155,5 @@ 1400389287,11080291.51 1400389343,11017300.69 1400389511,11126324.77 +1400393822,10834745.34 +1400393905,10709222.20 diff --git a/tests/check_tree.c b/tests/check_tree.c index 885dcf0..3113fa5 100644 --- a/tests/check_tree.c +++ b/tests/check_tree.c @@ -252,18 +252,18 @@ START_TEST(test_pcre_pattern_simple) match_entry * entry; entry = match_entry_createl( "/user/123" , strlen("/user/123") ); - n = r3_tree_create(10); + node * n = r3_tree_create(10); r3_tree_insert_pathl(n, "/user/{id}", strlen("/user/{id}"), NULL, NULL); r3_tree_insert_pathl(n, "/user", strlen("/user"), NULL, NULL); r3_tree_compile(n); r3_tree_dump(n, 0); - node *matched; - matched = r3_tree_match(n , "/blog/post", strlen("/blog/post"), entry); - - + matched = r3_tree_match(n, "/user/123", strlen("/user/123"), entry); + ck_assert_int_gt(entry->vars->len, 0); + ck_assert_str_eq(entry->vars->tokens[0],"123"); } +END_TEST START_TEST(test_insert_route) {