From 90721f2d39b0cdd5d22409f1bf4f6ce4b7382944 Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Fri, 6 Mar 2015 17:36:08 -0500 Subject: [PATCH] directory cleanup: move tests and data into subdirectories --- Makefile | 50 ++++++++++----------- data_generator.rb => data/data_generator.rb | 0 graphemetest.c => test/graphemetest.c | 4 +- normtest.c => test/normtest.c | 4 +- printproperty.c => test/printproperty.c | 0 tests.h => test/tests.h | 2 +- 6 files changed, 30 insertions(+), 30 deletions(-) rename data_generator.rb => data/data_generator.rb (100%) rename graphemetest.c => test/graphemetest.c (96%) rename normtest.c => test/normtest.c (95%) rename printproperty.c => test/printproperty.c (100%) rename tests.h => test/tests.h (98%) diff --git a/Makefile b/Makefile index 8517192..678f5b6 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ all: c-library c-library: libutf8proc.a libutf8proc.$(SHLIB_EXT) clean: - rm -f utf8proc.o libutf8proc.a libutf8proc.$(SHLIB_EXT) normtest graphemetest UnicodeData.txt DerivedCoreProperties.txt CompositionExclusions.txt CaseFolding.txt NormalizationTest.txt GraphemeBreakTest.txt + rm -f utf8proc.o libutf8proc.a libutf8proc.$(SHLIB_EXT) test/normtest test/graphemetest data/UnicodeData.txt data/DerivedCoreProperties.txt data/CompositionExclusions.txt data/CaseFolding.txt data/NormalizationTest.txt data/GraphemeBreakTest.txt $(MAKE) -C bench clean update: utf8proc_data.c.new @@ -33,23 +33,23 @@ update: utf8proc_data.c.new # real targets -utf8proc_data.c.new: data_generator.rb UnicodeData.txt GraphemeBreakProperty.txt DerivedCoreProperties.txt CompositionExclusions.txt CaseFolding.txt - $(RUBY) data_generator.rb < UnicodeData.txt > utf8proc_data.c.new +utf8proc_data.c.new: data/data_generator.rb data/UnicodeData.txt data/GraphemeBreakProperty.txt data/DerivedCoreProperties.txt data/CompositionExclusions.txt data/CaseFolding.txt + (cd data; $(RUBY) data_generator.rb < UnicodeData.txt) > utf8proc_data.c.new -UnicodeData.txt: - $(CURL) -O http://www.unicode.org/Public/UNIDATA/UnicodeData.txt +data/UnicodeData.txt: + $(CURL) -o $@ -O http://www.unicode.org/Public/UNIDATA/UnicodeData.txt -GraphemeBreakProperty.txt: - $(CURL) -O http://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakProperty.txt +data/GraphemeBreakProperty.txt: + $(CURL) -o $@ -O http://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakProperty.txt -DerivedCoreProperties.txt: - $(CURL) -O http://www.unicode.org/Public/UNIDATA/DerivedCoreProperties.txt +data/DerivedCoreProperties.txt: + $(CURL) -o $@ -O http://www.unicode.org/Public/UNIDATA/DerivedCoreProperties.txt -CompositionExclusions.txt: - $(CURL) -O http://www.unicode.org/Public/UNIDATA/CompositionExclusions.txt +data/CompositionExclusions.txt: + $(CURL) -o $@ -O http://www.unicode.org/Public/UNIDATA/CompositionExclusions.txt -CaseFolding.txt: - $(CURL) -O http://www.unicode.org/Public/UNIDATA/CaseFolding.txt +data/CaseFolding.txt: + $(CURL) -o $@ -O http://www.unicode.org/Public/UNIDATA/CaseFolding.txt utf8proc.o: utf8proc.h utf8proc.c utf8proc_data.c $(cc) -c -o utf8proc.o utf8proc.c @@ -68,21 +68,21 @@ libutf8proc.dylib: utf8proc.o # Test programs -NormalizationTest.txt: - $(CURL) -O http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt +data/NormalizationTest.txt: + $(CURL) -o $@ -O http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt -GraphemeBreakTest.txt: +data/GraphemeBreakTest.txt: $(CURL) http://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakTest.txt | $(PERL) -pe 's,÷,/,g;s,×,+,g' > $@ -normtest: normtest.c utf8proc.o utf8proc.h tests.h - $(cc) normtest.c utf8proc.o -o $@ +test/normtest: test/normtest.c utf8proc.o utf8proc.h test/tests.h + $(cc) test/normtest.c utf8proc.o -o $@ -graphemetest: graphemetest.c utf8proc.o utf8proc.h tests.h - $(cc) graphemetest.c utf8proc.o -o $@ +test/graphemetest: test/graphemetest.c utf8proc.o utf8proc.h test/tests.h + $(cc) test/graphemetest.c utf8proc.o -o $@ -printproperty: printproperty.c utf8proc.o utf8proc.h tests.h - $(cc) printproperty.c utf8proc.o -o $@ +test/printproperty: test/printproperty.c utf8proc.o utf8proc.h test/tests.h + $(cc) test/printproperty.c utf8proc.o -o $@ -check: normtest NormalizationTest.txt graphemetest GraphemeBreakTest.txt - ./normtest - ./graphemetest +check: test/normtest data/NormalizationTest.txt test/graphemetest data/GraphemeBreakTest.txt + test/normtest data/NormalizationTest.txt + test/graphemetest data/GraphemeBreakTest.txt diff --git a/data_generator.rb b/data/data_generator.rb similarity index 100% rename from data_generator.rb rename to data/data_generator.rb diff --git a/graphemetest.c b/test/graphemetest.c similarity index 96% rename from graphemetest.c rename to test/graphemetest.c index 094fa7f..7914dc8 100644 --- a/graphemetest.c +++ b/test/graphemetest.c @@ -1,10 +1,10 @@ #include "tests.h" -int main(void) +int main(int argc, char **argv) { char *buf = NULL; size_t bufsize = 0; - FILE *f = fopen("GraphemeBreakTest.txt", "r"); + FILE *f = argc > 1 ? fopen(argv[1], "r") : NULL; uint8_t src[1024]; check(f != NULL, "error opening GraphemeBreakTest.txt"); diff --git a/normtest.c b/test/normtest.c similarity index 95% rename from normtest.c rename to test/normtest.c index 6ccd813..7add4c6 100644 --- a/normtest.c +++ b/test/normtest.c @@ -7,11 +7,11 @@ free(src_norm); \ } -int main(void) +int main(int argc, char **argv) { char *buf = NULL; size_t bufsize = 0; - FILE *f = fopen("NormalizationTest.txt", "r"); + FILE *f = argc > 1 ? fopen(argv[1], "r") : NULL; char source[1024], NFC[1024], NFD[1024], NFKC[1024], NFKD[1024]; check(f != NULL, "error opening NormalizationTest.txt"); diff --git a/printproperty.c b/test/printproperty.c similarity index 100% rename from printproperty.c rename to test/printproperty.c diff --git a/tests.h b/test/tests.h similarity index 98% rename from tests.h rename to test/tests.h index aee3a57..d4897f8 100644 --- a/tests.h +++ b/test/tests.h @@ -6,7 +6,7 @@ #include #include -#include "utf8proc.h" +#include "../utf8proc.h" size_t lineno = 0;