From 80105977259d8b10f301b88bc5f06aa822454659 Mon Sep 17 00:00:00 2001 From: lindig Date: Tue, 27 Mar 2007 14:14:07 +0000 Subject: [PATCH] compiled using OCaml 3.10beta and added a few test cases; run them with "make test" git-svn-id: http://ocaml-annot.googlecode.com/svn/trunk@28 790f693a-e429-0410-ac51-454e36e68905 --- README | 2 ++ src/Makefile | 9 +++++++++ src/test.in | 6 ++++++ src/test.ml | 8 ++++++++ src/test.ref | 6 ++++++ 5 files changed, 31 insertions(+) create mode 100644 src/test.in create mode 100644 src/test.ml create mode 100644 src/test.ref diff --git a/README b/README index 4aebce3..5733e76 100644 --- a/README +++ b/README @@ -36,6 +36,8 @@ The configure script tries to locate all necessary tools and generates a file config.mk that is included by the main Makefile. If something goes wrong, try running "./configure -v". +The latest OCaml version that I have used for tests is OCaml 3.10 beta. + USING ANNOT FROM AN EDITOR To use Annot from Vim, include the following code into your ~/.vimrc diff --git a/src/Makefile b/src/Makefile index 6d95960..d30adf3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -26,6 +26,7 @@ clean: rm -f DEPEND rm -f load.ml *.annot rm -f pod2* + rm -f test.out clobber: clean rm -f $(NAME).byte $(NAME).opt @@ -36,6 +37,14 @@ install: $(NAME).$(BINEXT) $(NAME).1 $(BINDIR) $(MAN1DIR) cp $(NAME).$(BINEXT) $(BINDIR)/$(NAME) cp $(NAME).1 $(MAN1DIR) + +test: test.annot test.in + rm -f test.out + while read LINE COL; do \ + ./$(NAME).$(BINEXT) -type $$LINE $$COL test.annot >> test.out;\ + done < test.in + diff test.ref test.out + $(BINDIR): mkdir -p $@ diff --git a/src/test.in b/src/test.in new file mode 100644 index 0000000..984b224 --- /dev/null +++ b/src/test.in @@ -0,0 +1,6 @@ +4 6 +4 8 +5 9 +5 13 +7 16 +7 23 diff --git a/src/test.ml b/src/test.ml new file mode 100644 index 0000000..8117fa8 --- /dev/null +++ b/src/test.ml @@ -0,0 +1,8 @@ + +(* this module simply contains some test cases *) + +let id x = x +let rec map f = function + | [] -> [] + | x::xs -> f x :: map f xs + diff --git a/src/test.ref b/src/test.ref new file mode 100644 index 0000000..a3a9541 --- /dev/null +++ b/src/test.ref @@ -0,0 +1,6 @@ + 'a -> 'a + 'a + ('a -> 'b) -> 'a list -> 'b list + 'a -> 'b + 'a -> 'b + ('a -> 'b) -> 'a list -> 'b list