Add gvc_render and gvc_render tests
This commit is contained in:
parent
b7c4829c2b
commit
b7d20ecc24
9 changed files with 241 additions and 30 deletions
|
@ -111,7 +111,7 @@ if ( $error ) {
|
||||||
Install
|
Install
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
sudo apt-get install check libpcre3 libpcre3-dev libjemalloc-dev libjemalloc1 build-essential libtool automake autoconf
|
sudo apt-get install check libpcre3 libpcre3-dev libjemalloc-dev libjemalloc1 build-essential libtool automake autoconf graphviz-dev graphviz
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
./configure && make
|
./configure && make
|
||||||
make check # run tests
|
make check # run tests
|
||||||
|
|
|
@ -816,8 +816,8 @@ cat >>"$ac_tmp/subs1.awk" <<\_ACAWK &&
|
||||||
S["am__EXEEXT_FALSE"]=""
|
S["am__EXEEXT_FALSE"]=""
|
||||||
S["am__EXEEXT_TRUE"]="#"
|
S["am__EXEEXT_TRUE"]="#"
|
||||||
S["LTLIBOBJS"]=""
|
S["LTLIBOBJS"]=""
|
||||||
S["DEPS_LIBS"]="-L/opt/local/lib -lpcre -lcheck "
|
S["DEPS_LIBS"]="-L/opt/local/lib -lpcre -lcheck -lgvc -lcgraph -lcdt "
|
||||||
S["DEPS_CFLAGS"]="-D_THREAD_SAFE -I/opt/local/include "
|
S["DEPS_CFLAGS"]="-D_THREAD_SAFE -I/opt/local/include -I/opt/local/include/graphviz "
|
||||||
S["PKG_CONFIG_LIBDIR"]=""
|
S["PKG_CONFIG_LIBDIR"]=""
|
||||||
S["PKG_CONFIG_PATH"]=""
|
S["PKG_CONFIG_PATH"]=""
|
||||||
S["PKG_CONFIG"]="/opt/local/bin/pkg-config"
|
S["PKG_CONFIG"]="/opt/local/bin/pkg-config"
|
||||||
|
|
18
configure
vendored
18
configure
vendored
|
@ -13131,12 +13131,12 @@ if test -n "$DEPS_CFLAGS"; then
|
||||||
pkg_cv_DEPS_CFLAGS="$DEPS_CFLAGS"
|
pkg_cv_DEPS_CFLAGS="$DEPS_CFLAGS"
|
||||||
elif test -n "$PKG_CONFIG"; then
|
elif test -n "$PKG_CONFIG"; then
|
||||||
if test -n "$PKG_CONFIG" && \
|
if test -n "$PKG_CONFIG" && \
|
||||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpcre check gvc\""; } >&5
|
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpcre check libgvc\""; } >&5
|
||||||
($PKG_CONFIG --exists --print-errors "libpcre check gvc") 2>&5
|
($PKG_CONFIG --exists --print-errors "libpcre check libgvc") 2>&5
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
test $ac_status = 0; }; then
|
test $ac_status = 0; }; then
|
||||||
pkg_cv_DEPS_CFLAGS=`$PKG_CONFIG --cflags "libpcre check gvc" 2>/dev/null`
|
pkg_cv_DEPS_CFLAGS=`$PKG_CONFIG --cflags "libpcre check libgvc" 2>/dev/null`
|
||||||
test "x$?" != "x0" && pkg_failed=yes
|
test "x$?" != "x0" && pkg_failed=yes
|
||||||
else
|
else
|
||||||
pkg_failed=yes
|
pkg_failed=yes
|
||||||
|
@ -13148,12 +13148,12 @@ if test -n "$DEPS_LIBS"; then
|
||||||
pkg_cv_DEPS_LIBS="$DEPS_LIBS"
|
pkg_cv_DEPS_LIBS="$DEPS_LIBS"
|
||||||
elif test -n "$PKG_CONFIG"; then
|
elif test -n "$PKG_CONFIG"; then
|
||||||
if test -n "$PKG_CONFIG" && \
|
if test -n "$PKG_CONFIG" && \
|
||||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpcre check gvc\""; } >&5
|
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpcre check libgvc\""; } >&5
|
||||||
($PKG_CONFIG --exists --print-errors "libpcre check gvc") 2>&5
|
($PKG_CONFIG --exists --print-errors "libpcre check libgvc") 2>&5
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
test $ac_status = 0; }; then
|
test $ac_status = 0; }; then
|
||||||
pkg_cv_DEPS_LIBS=`$PKG_CONFIG --libs "libpcre check gvc" 2>/dev/null`
|
pkg_cv_DEPS_LIBS=`$PKG_CONFIG --libs "libpcre check libgvc" 2>/dev/null`
|
||||||
test "x$?" != "x0" && pkg_failed=yes
|
test "x$?" != "x0" && pkg_failed=yes
|
||||||
else
|
else
|
||||||
pkg_failed=yes
|
pkg_failed=yes
|
||||||
|
@ -13174,14 +13174,14 @@ else
|
||||||
_pkg_short_errors_supported=no
|
_pkg_short_errors_supported=no
|
||||||
fi
|
fi
|
||||||
if test $_pkg_short_errors_supported = yes; then
|
if test $_pkg_short_errors_supported = yes; then
|
||||||
DEPS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpcre check gvc" 2>&1`
|
DEPS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpcre check libgvc" 2>&1`
|
||||||
else
|
else
|
||||||
DEPS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpcre check gvc" 2>&1`
|
DEPS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpcre check libgvc" 2>&1`
|
||||||
fi
|
fi
|
||||||
# Put the nasty error message in config.log where it belongs
|
# Put the nasty error message in config.log where it belongs
|
||||||
echo "$DEPS_PKG_ERRORS" >&5
|
echo "$DEPS_PKG_ERRORS" >&5
|
||||||
|
|
||||||
as_fn_error $? "Package requirements (libpcre check gvc) were not met:
|
as_fn_error $? "Package requirements (libpcre check libgvc) were not met:
|
||||||
|
|
||||||
$DEPS_PKG_ERRORS
|
$DEPS_PKG_ERRORS
|
||||||
|
|
||||||
|
|
|
@ -106,6 +106,8 @@ void r3_tree_dump(node * n, int level);
|
||||||
|
|
||||||
int r3_tree_render_file(node * tree, char * format, char * filename);
|
int r3_tree_render_file(node * tree, char * format, char * filename);
|
||||||
|
|
||||||
|
int r3_tree_render_dot(node * tree);
|
||||||
|
|
||||||
edge * r3_node_find_edge_str(node * n, char * str, int str_len);
|
edge * r3_node_find_edge_str(node * n, char * str, int str_len);
|
||||||
|
|
||||||
|
|
||||||
|
|
74
src/gvc.c
74
src/gvc.c
|
@ -10,12 +10,71 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "r3.h"
|
#include "r3.h"
|
||||||
|
|
||||||
// int main(int argc, char **argv)
|
|
||||||
|
char * node_id_str(int id) {
|
||||||
|
char * name = malloc(sizeof(char) * 20);
|
||||||
|
sprintf(name, "#%d", id);
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
int r3_tree_build_ag_nodes(Agraph_t * g, Agnode_t * ag_parent_node, node * n, int node_cnt) {
|
||||||
|
edge * e;
|
||||||
|
Agnode_t *agn_child;
|
||||||
|
Agedge_t *agn_edge;
|
||||||
|
|
||||||
|
for ( int i = 0 ; i < n->edge_len ; i++ ) {
|
||||||
|
e = n->edges[i];
|
||||||
|
|
||||||
|
node_cnt++;
|
||||||
|
agn_child = agnode(g, node_id_str(node_cnt) , 1);
|
||||||
|
agn_edge = agedge(g, ag_parent_node, agn_child, 0, 1);
|
||||||
|
agsafeset(agn_edge, "label", e->pattern, "");
|
||||||
|
|
||||||
|
r3_tree_build_ag_nodes(g, agn_child, e->child, node_cnt);
|
||||||
|
|
||||||
|
// agedgeattr(agn_edge, "label", e->pattern );
|
||||||
|
// agattr(gr, AGEDGE, "style","invis");
|
||||||
|
// agattr(agn_edge, AGEDGE, "label", "test");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render a tree to tree graph image via graphviz (dot)
|
||||||
|
*/
|
||||||
|
int r3_tree_render_dot(node * tree)
|
||||||
|
{
|
||||||
|
Agraph_t *g;
|
||||||
|
/* set up a graphviz context - but only once even for multiple graphs */
|
||||||
|
static GVC_t *gvc;
|
||||||
|
|
||||||
|
if (!gvc) {
|
||||||
|
gvc = gvContext();
|
||||||
|
}
|
||||||
|
/* Create a simple digraph */
|
||||||
|
g = agopen("g", Agdirected, 0);
|
||||||
|
|
||||||
|
// create self node
|
||||||
|
Agnode_t *ag_root = agnode(g, "{root}", 1);
|
||||||
|
r3_tree_build_ag_nodes(g, ag_root, tree, 0);
|
||||||
|
gvLayout(gvc, g, "dot");
|
||||||
|
gvRender(gvc, g, "dot", stdout);
|
||||||
|
gvFreeLayout(gvc, g);
|
||||||
|
agclose(g);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render a tree to tree graph image via graphviz (dot)
|
||||||
|
*/
|
||||||
int r3_tree_render_file(node * tree, char * format, char * filename)
|
int r3_tree_render_file(node * tree, char * format, char * filename)
|
||||||
{
|
{
|
||||||
Agraph_t *g;
|
Agraph_t *g;
|
||||||
Agnode_t *n, *m;
|
|
||||||
Agedge_t *e;
|
|
||||||
|
|
||||||
/* set up a graphviz context - but only once even for multiple graphs */
|
/* set up a graphviz context - but only once even for multiple graphs */
|
||||||
static GVC_t *gvc;
|
static GVC_t *gvc;
|
||||||
|
@ -27,13 +86,10 @@ int r3_tree_render_file(node * tree, char * format, char * filename)
|
||||||
/* Create a simple digraph */
|
/* Create a simple digraph */
|
||||||
g = agopen("g", Agdirected, 0);
|
g = agopen("g", Agdirected, 0);
|
||||||
|
|
||||||
n = agnode(g, "n", 1);
|
// create self node
|
||||||
m = agnode(g, "m", 1);
|
Agnode_t *ag_root = agnode(g, "{root}", 1);
|
||||||
e = agedge(g, n, m, 0, 1);
|
r3_tree_build_ag_nodes(g, ag_root, tree, 0);
|
||||||
|
|
||||||
/* Set an attribute - in this case one that affects the visible rendering */
|
|
||||||
agsafeset(n, "color", "red", "");
|
|
||||||
/* Use the directed graph layout engine */
|
|
||||||
gvLayout(gvc, g, "dot");
|
gvLayout(gvc, g, "dot");
|
||||||
gvRenderFilename(gvc, g, format, filename);
|
gvRenderFilename(gvc, g, format, filename);
|
||||||
gvFreeLayout(gvc, g);
|
gvFreeLayout(gvc, g);
|
||||||
|
|
|
@ -4,12 +4,17 @@
|
||||||
# else
|
# else
|
||||||
# TESTS =
|
# TESTS =
|
||||||
# endif
|
# endif
|
||||||
TESTS = check_tree
|
TESTS = check_tree check_gvc
|
||||||
# noinst_PROGRAMS = $(TESTS)
|
# noinst_PROGRAMS = $(TESTS)
|
||||||
check_PROGRAMS = $(TESTS)
|
check_PROGRAMS = $(TESTS)
|
||||||
check_tree_SOURCES = check_tree.c bench.c
|
check_tree_SOURCES = check_tree.c bench.c
|
||||||
check_tree_LDADD=$(DEPS_LIBS) -L$(top_builddir)/src -lr3 @CHECK_LIBS@
|
check_tree_LDADD=$(DEPS_LIBS) -L$(top_builddir)/src -lr3 @CHECK_LIBS@
|
||||||
check_tree_CFLAGS=$(DEPS_CFLAGS) -I$(top_builddir) -I$(top_builddir)/include @CHECK_CFLAGS@
|
check_tree_CFLAGS=$(DEPS_CFLAGS) -I$(top_builddir) -I$(top_builddir)/include @CHECK_CFLAGS@
|
||||||
|
|
||||||
|
check_gvc_SOURCES = check_gvc.c bench.c
|
||||||
|
check_gvc_LDADD=$(DEPS_LIBS) -L$(top_builddir)/src -lr3 @CHECK_LIBS@
|
||||||
|
check_gvc_CFLAGS=$(DEPS_CFLAGS) -I$(top_builddir) -I$(top_builddir)/include @CHECK_CFLAGS@
|
||||||
|
|
||||||
# AM_CFLAGS=$(DEPS_CFLAGS) -I$(top_builddir)/include
|
# AM_CFLAGS=$(DEPS_CFLAGS) -I$(top_builddir)/include
|
||||||
# AM_CFLAGS=$(DEPS_CFLAGS) -I$(top_builddir) -I$(top_builddir)/include
|
# AM_CFLAGS=$(DEPS_CFLAGS) -I$(top_builddir) -I$(top_builddir)/include
|
||||||
CLEANFILES = check_tree.log
|
CLEANFILES = check_tree.log
|
||||||
|
|
|
@ -77,7 +77,7 @@ PRE_UNINSTALL = :
|
||||||
POST_UNINSTALL = :
|
POST_UNINSTALL = :
|
||||||
build_triplet = @build@
|
build_triplet = @build@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
TESTS = check_tree$(EXEEXT)
|
TESTS = check_tree$(EXEEXT) check_gvc$(EXEEXT)
|
||||||
check_PROGRAMS = $(am__EXEEXT_1)
|
check_PROGRAMS = $(am__EXEEXT_1)
|
||||||
subdir = tests
|
subdir = tests
|
||||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||||
|
@ -93,16 +93,23 @@ mkinstalldirs = $(install_sh) -d
|
||||||
CONFIG_HEADER = $(top_builddir)/config.h
|
CONFIG_HEADER = $(top_builddir)/config.h
|
||||||
CONFIG_CLEAN_FILES =
|
CONFIG_CLEAN_FILES =
|
||||||
CONFIG_CLEAN_VPATH_FILES =
|
CONFIG_CLEAN_VPATH_FILES =
|
||||||
am__EXEEXT_1 = check_tree$(EXEEXT)
|
am__EXEEXT_1 = check_tree$(EXEEXT) check_gvc$(EXEEXT)
|
||||||
am_check_tree_OBJECTS = check_tree-check_tree.$(OBJEXT) \
|
am_check_gvc_OBJECTS = check_gvc-check_gvc.$(OBJEXT) \
|
||||||
check_tree-bench.$(OBJEXT)
|
check_gvc-bench.$(OBJEXT)
|
||||||
check_tree_OBJECTS = $(am_check_tree_OBJECTS)
|
check_gvc_OBJECTS = $(am_check_gvc_OBJECTS)
|
||||||
am__DEPENDENCIES_1 =
|
am__DEPENDENCIES_1 =
|
||||||
check_tree_DEPENDENCIES = $(am__DEPENDENCIES_1)
|
check_gvc_DEPENDENCIES = $(am__DEPENDENCIES_1)
|
||||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||||
am__v_lt_0 = --silent
|
am__v_lt_0 = --silent
|
||||||
am__v_lt_1 =
|
am__v_lt_1 =
|
||||||
|
check_gvc_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||||
|
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(check_gvc_CFLAGS) \
|
||||||
|
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||||
|
am_check_tree_OBJECTS = check_tree-check_tree.$(OBJEXT) \
|
||||||
|
check_tree-bench.$(OBJEXT)
|
||||||
|
check_tree_OBJECTS = $(am_check_tree_OBJECTS)
|
||||||
|
check_tree_DEPENDENCIES = $(am__DEPENDENCIES_1)
|
||||||
check_tree_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
check_tree_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(check_tree_CFLAGS) \
|
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(check_tree_CFLAGS) \
|
||||||
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||||
|
@ -140,8 +147,8 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
||||||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||||
am__v_CCLD_1 =
|
am__v_CCLD_1 =
|
||||||
SOURCES = $(check_tree_SOURCES)
|
SOURCES = $(check_gvc_SOURCES) $(check_tree_SOURCES)
|
||||||
DIST_SOURCES = $(check_tree_SOURCES)
|
DIST_SOURCES = $(check_gvc_SOURCES) $(check_tree_SOURCES)
|
||||||
am__can_run_installinfo = \
|
am__can_run_installinfo = \
|
||||||
case $$AM_UPDATE_INFO_DIR in \
|
case $$AM_UPDATE_INFO_DIR in \
|
||||||
n|no|NO) false;; \
|
n|no|NO) false;; \
|
||||||
|
@ -495,6 +502,10 @@ top_srcdir = @top_srcdir@
|
||||||
check_tree_SOURCES = check_tree.c bench.c
|
check_tree_SOURCES = check_tree.c bench.c
|
||||||
check_tree_LDADD = $(DEPS_LIBS) -L$(top_builddir)/src -lr3 @CHECK_LIBS@
|
check_tree_LDADD = $(DEPS_LIBS) -L$(top_builddir)/src -lr3 @CHECK_LIBS@
|
||||||
check_tree_CFLAGS = $(DEPS_CFLAGS) -I$(top_builddir) -I$(top_builddir)/include @CHECK_CFLAGS@
|
check_tree_CFLAGS = $(DEPS_CFLAGS) -I$(top_builddir) -I$(top_builddir)/include @CHECK_CFLAGS@
|
||||||
|
check_gvc_SOURCES = check_gvc.c bench.c
|
||||||
|
check_gvc_LDADD = $(DEPS_LIBS) -L$(top_builddir)/src -lr3 @CHECK_LIBS@
|
||||||
|
check_gvc_CFLAGS = $(DEPS_CFLAGS) -I$(top_builddir) -I$(top_builddir)/include @CHECK_CFLAGS@
|
||||||
|
|
||||||
# AM_CFLAGS=$(DEPS_CFLAGS) -I$(top_builddir)/include
|
# AM_CFLAGS=$(DEPS_CFLAGS) -I$(top_builddir)/include
|
||||||
# AM_CFLAGS=$(DEPS_CFLAGS) -I$(top_builddir) -I$(top_builddir)/include
|
# AM_CFLAGS=$(DEPS_CFLAGS) -I$(top_builddir) -I$(top_builddir)/include
|
||||||
CLEANFILES = check_tree.log
|
CLEANFILES = check_tree.log
|
||||||
|
@ -542,6 +553,10 @@ clean-checkPROGRAMS:
|
||||||
echo " rm -f" $$list; \
|
echo " rm -f" $$list; \
|
||||||
rm -f $$list
|
rm -f $$list
|
||||||
|
|
||||||
|
check_gvc$(EXEEXT): $(check_gvc_OBJECTS) $(check_gvc_DEPENDENCIES) $(EXTRA_check_gvc_DEPENDENCIES)
|
||||||
|
@rm -f check_gvc$(EXEEXT)
|
||||||
|
$(AM_V_CCLD)$(check_gvc_LINK) $(check_gvc_OBJECTS) $(check_gvc_LDADD) $(LIBS)
|
||||||
|
|
||||||
check_tree$(EXEEXT): $(check_tree_OBJECTS) $(check_tree_DEPENDENCIES) $(EXTRA_check_tree_DEPENDENCIES)
|
check_tree$(EXEEXT): $(check_tree_OBJECTS) $(check_tree_DEPENDENCIES) $(EXTRA_check_tree_DEPENDENCIES)
|
||||||
@rm -f check_tree$(EXEEXT)
|
@rm -f check_tree$(EXEEXT)
|
||||||
$(AM_V_CCLD)$(check_tree_LINK) $(check_tree_OBJECTS) $(check_tree_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(check_tree_LINK) $(check_tree_OBJECTS) $(check_tree_LDADD) $(LIBS)
|
||||||
|
@ -552,6 +567,8 @@ mostlyclean-compile:
|
||||||
distclean-compile:
|
distclean-compile:
|
||||||
-rm -f *.tab.c
|
-rm -f *.tab.c
|
||||||
|
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_gvc-bench.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_gvc-check_gvc.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_tree-bench.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_tree-bench.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_tree-check_tree.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_tree-check_tree.Po@am__quote@
|
||||||
|
|
||||||
|
@ -576,6 +593,34 @@ distclean-compile:
|
||||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
|
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
|
||||||
|
|
||||||
|
check_gvc-check_gvc.o: check_gvc.c
|
||||||
|
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_gvc_CFLAGS) $(CFLAGS) -MT check_gvc-check_gvc.o -MD -MP -MF $(DEPDIR)/check_gvc-check_gvc.Tpo -c -o check_gvc-check_gvc.o `test -f 'check_gvc.c' || echo '$(srcdir)/'`check_gvc.c
|
||||||
|
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/check_gvc-check_gvc.Tpo $(DEPDIR)/check_gvc-check_gvc.Po
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='check_gvc.c' object='check_gvc-check_gvc.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_gvc_CFLAGS) $(CFLAGS) -c -o check_gvc-check_gvc.o `test -f 'check_gvc.c' || echo '$(srcdir)/'`check_gvc.c
|
||||||
|
|
||||||
|
check_gvc-check_gvc.obj: check_gvc.c
|
||||||
|
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_gvc_CFLAGS) $(CFLAGS) -MT check_gvc-check_gvc.obj -MD -MP -MF $(DEPDIR)/check_gvc-check_gvc.Tpo -c -o check_gvc-check_gvc.obj `if test -f 'check_gvc.c'; then $(CYGPATH_W) 'check_gvc.c'; else $(CYGPATH_W) '$(srcdir)/check_gvc.c'; fi`
|
||||||
|
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/check_gvc-check_gvc.Tpo $(DEPDIR)/check_gvc-check_gvc.Po
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='check_gvc.c' object='check_gvc-check_gvc.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_gvc_CFLAGS) $(CFLAGS) -c -o check_gvc-check_gvc.obj `if test -f 'check_gvc.c'; then $(CYGPATH_W) 'check_gvc.c'; else $(CYGPATH_W) '$(srcdir)/check_gvc.c'; fi`
|
||||||
|
|
||||||
|
check_gvc-bench.o: bench.c
|
||||||
|
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_gvc_CFLAGS) $(CFLAGS) -MT check_gvc-bench.o -MD -MP -MF $(DEPDIR)/check_gvc-bench.Tpo -c -o check_gvc-bench.o `test -f 'bench.c' || echo '$(srcdir)/'`bench.c
|
||||||
|
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/check_gvc-bench.Tpo $(DEPDIR)/check_gvc-bench.Po
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bench.c' object='check_gvc-bench.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_gvc_CFLAGS) $(CFLAGS) -c -o check_gvc-bench.o `test -f 'bench.c' || echo '$(srcdir)/'`bench.c
|
||||||
|
|
||||||
|
check_gvc-bench.obj: bench.c
|
||||||
|
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_gvc_CFLAGS) $(CFLAGS) -MT check_gvc-bench.obj -MD -MP -MF $(DEPDIR)/check_gvc-bench.Tpo -c -o check_gvc-bench.obj `if test -f 'bench.c'; then $(CYGPATH_W) 'bench.c'; else $(CYGPATH_W) '$(srcdir)/bench.c'; fi`
|
||||||
|
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/check_gvc-bench.Tpo $(DEPDIR)/check_gvc-bench.Po
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bench.c' object='check_gvc-bench.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_gvc_CFLAGS) $(CFLAGS) -c -o check_gvc-bench.obj `if test -f 'bench.c'; then $(CYGPATH_W) 'bench.c'; else $(CYGPATH_W) '$(srcdir)/bench.c'; fi`
|
||||||
|
|
||||||
check_tree-check_tree.o: check_tree.c
|
check_tree-check_tree.o: check_tree.c
|
||||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_tree_CFLAGS) $(CFLAGS) -MT check_tree-check_tree.o -MD -MP -MF $(DEPDIR)/check_tree-check_tree.Tpo -c -o check_tree-check_tree.o `test -f 'check_tree.c' || echo '$(srcdir)/'`check_tree.c
|
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_tree_CFLAGS) $(CFLAGS) -MT check_tree-check_tree.o -MD -MP -MF $(DEPDIR)/check_tree-check_tree.Tpo -c -o check_tree-check_tree.o `test -f 'check_tree.c' || echo '$(srcdir)/'`check_tree.c
|
||||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/check_tree-check_tree.Tpo $(DEPDIR)/check_tree-check_tree.Po
|
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/check_tree-check_tree.Tpo $(DEPDIR)/check_tree-check_tree.Po
|
||||||
|
@ -810,6 +855,13 @@ check_tree.log: check_tree$(EXEEXT)
|
||||||
--log-file $$b.log --trs-file $$b.trs \
|
--log-file $$b.log --trs-file $$b.trs \
|
||||||
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
|
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
|
||||||
"$$tst" $(AM_TESTS_FD_REDIRECT)
|
"$$tst" $(AM_TESTS_FD_REDIRECT)
|
||||||
|
check_gvc.log: check_gvc$(EXEEXT)
|
||||||
|
@p='check_gvc$(EXEEXT)'; \
|
||||||
|
b='check_gvc'; \
|
||||||
|
$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
|
||||||
|
--log-file $$b.log --trs-file $$b.trs \
|
||||||
|
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
|
||||||
|
"$$tst" $(AM_TESTS_FD_REDIRECT)
|
||||||
.test.log:
|
.test.log:
|
||||||
@p='$<'; \
|
@p='$<'; \
|
||||||
$(am__set_b); \
|
$(am__set_b); \
|
||||||
|
|
|
@ -57,3 +57,24 @@
|
||||||
1400283485,10742869.09
|
1400283485,10742869.09
|
||||||
1400283755,11545078.70
|
1400283755,11545078.70
|
||||||
1400284307,11493777.72
|
1400284307,11493777.72
|
||||||
|
1400370342,11414560.92
|
||||||
|
1400370407,10759059.85
|
||||||
|
1400370448,10686226.48
|
||||||
|
1400370672,10532221.14
|
||||||
|
1400370683,10874340.04
|
||||||
|
1400370920,11307031.13
|
||||||
|
1400371082,9136908.63
|
||||||
|
1400371092,11106355.37
|
||||||
|
1400371132,11313608.81
|
||||||
|
1400371165,10266146.59
|
||||||
|
1400371326,10644609.51
|
||||||
|
1400371371,10958943.43
|
||||||
|
1400371431,10145302.26
|
||||||
|
1400371504,11383090.96
|
||||||
|
1400371511,10023676.85
|
||||||
|
1400371561,10912042.58
|
||||||
|
1400371589,11439666.09
|
||||||
|
1400371602,11012616.42
|
||||||
|
1400371709,11058171.50
|
||||||
|
1400371751,11091926.38
|
||||||
|
1400371943,11103873.79
|
||||||
|
|
|
75
tests/check_gvc.c
Normal file
75
tests/check_gvc.c
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
/*
|
||||||
|
* check_gvc.c
|
||||||
|
* Copyright (C) 2014 c9s <c9s@c9smba.local>
|
||||||
|
*
|
||||||
|
* Distributed under terms of the MIT license.
|
||||||
|
*/
|
||||||
|
#include "config.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <check.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "r3.h"
|
||||||
|
#include "r3_str.h"
|
||||||
|
#include "str_array.h"
|
||||||
|
#include "bench.h"
|
||||||
|
|
||||||
|
START_TEST (test_gvc_render_dot)
|
||||||
|
{
|
||||||
|
node * n = r3_tree_create(1);
|
||||||
|
|
||||||
|
r3_tree_insert_path(n, "/foo/bar/baz", NULL);
|
||||||
|
r3_tree_insert_path(n, "/foo/bar/qux", NULL);
|
||||||
|
r3_tree_insert_path(n, "/foo/bar/quux", NULL);
|
||||||
|
r3_tree_insert_path(n, "/foo/bar/corge", NULL);
|
||||||
|
r3_tree_insert_path(n, "/foo/bar/grault", NULL);
|
||||||
|
r3_tree_insert_path(n, "/garply/grault/foo", NULL);
|
||||||
|
r3_tree_insert_path(n, "/garply/grault/bar", NULL);
|
||||||
|
|
||||||
|
r3_tree_compile(n);
|
||||||
|
|
||||||
|
r3_tree_render_dot(n);
|
||||||
|
|
||||||
|
r3_tree_free(n);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST (test_gvc_render_file)
|
||||||
|
{
|
||||||
|
|
||||||
|
node * n = r3_tree_create(1);
|
||||||
|
|
||||||
|
r3_tree_insert_path(n, "/foo/bar/baz", NULL);
|
||||||
|
r3_tree_insert_path(n, "/foo/bar/qux", NULL);
|
||||||
|
r3_tree_insert_path(n, "/foo/bar/quux", NULL);
|
||||||
|
r3_tree_insert_path(n, "/foo/bar/corge", NULL);
|
||||||
|
r3_tree_insert_path(n, "/foo/bar/grault", NULL);
|
||||||
|
r3_tree_insert_path(n, "/garply/grault/foo", NULL);
|
||||||
|
r3_tree_insert_path(n, "/garply/grault/bar", NULL);
|
||||||
|
|
||||||
|
r3_tree_compile(n);
|
||||||
|
|
||||||
|
r3_tree_render_file(n, "png", "check_gvc.png");
|
||||||
|
|
||||||
|
r3_tree_free(n);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
|
||||||
|
Suite* r3_suite (void) {
|
||||||
|
Suite *suite = suite_create("gvc test");
|
||||||
|
TCase *tcase = tcase_create("test_gvc");
|
||||||
|
tcase_add_test(tcase, test_gvc_render_file);
|
||||||
|
tcase_add_test(tcase, test_gvc_render_dot);
|
||||||
|
suite_add_tcase(suite, tcase);
|
||||||
|
return suite;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main (int argc, char *argv[]) {
|
||||||
|
int number_failed;
|
||||||
|
Suite *suite = r3_suite();
|
||||||
|
SRunner *runner = srunner_create(suite);
|
||||||
|
srunner_run_all(runner, CK_NORMAL);
|
||||||
|
number_failed = srunner_ntests_failed(runner);
|
||||||
|
srunner_free(runner);
|
||||||
|
return number_failed;
|
||||||
|
}
|
Loading…
Reference in a new issue