diff options
author | Constantin Jucovschi <cj@ubuntu.localdomain> | 2009-04-24 07:20:22 -0400 |
---|---|---|
committer | Constantin Jucovschi <cj@ubuntu.localdomain> | 2009-04-24 07:20:22 -0400 |
commit | 8f27e65bddd7d4b8515ce620fb485fdd78fcdf89 (patch) | |
tree | bd328a4dd4f92d32202241b5e3a7f36177792c5f /rasdl/test | |
download | rasdaman-upstream-8f27e65bddd7d4b8515ce620fb485fdd78fcdf89.tar.gz rasdaman-upstream-8f27e65bddd7d4b8515ce620fb485fdd78fcdf89.tar.xz rasdaman-upstream-8f27e65bddd7d4b8515ce620fb485fdd78fcdf89.zip |
Initial commitv8.0
Diffstat (limited to 'rasdl/test')
-rw-r--r-- | rasdl/test/Makefile | 78 | ||||
-rw-r--r-- | rasdl/test/basictypes.dl | 157 | ||||
-rw-r--r-- | rasdl/test/rasdl_test.sh | 103 | ||||
-rw-r--r-- | rasdl/test/test_rasdl.cc | 80 |
4 files changed, 418 insertions, 0 deletions
diff --git a/rasdl/test/Makefile b/rasdl/test/Makefile new file mode 100644 index 0000000..765ae1a --- /dev/null +++ b/rasdl/test/Makefile @@ -0,0 +1,78 @@ +# -*-Makefile-*- +# +# This file is part of rasdaman community. +# +# Rasdaman community is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Rasdaman community is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with rasdaman community. If not, see <http://www.gnu.org/licenses/>. +# +# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +# rasdaman GmbH. +# +# For more information please see <http://www.rasdaman.org> +# or contact Peter Baumann via <baumann@rasdaman.com>. +# +# MAKEFILE FOR: +# test programs of module qlparser +# +# COMMENTS: +# +################################################################## +# +# This is just an example Makefile for a test program. +# The dependency of the test program on the lib of the +# corresponding module is in the Makefile of the module. +# + +######################### Definitions ############################ + +# standard include with general options +include $(RMANBASE)/Makefile.inc + +# all test programs +SRCCXX = test_rasdl.cc +OBJS = ${SRCCXX:%.cc=%.o} +ALLTESTS = ${SRCCXX:%.cc=%} +MISCCLEAN = core + +# add compile and link options for STL +CXXFLAGS += $(STLCXXFLAGS) +LDFLAGS += $(STLLDFLAGS) + +########################### Targets ############################## + +# general system test +.PHONY: systemtest +systemtest: + rasdl_test.sh > rasdl_test.log 2>&1 + diff rasdl_test.log rasdl_test.log.orig || (echo deviation found in rasdl test; exit) + +# test target for qlparser +.PHONY : rasdl +rasdl: test_module test_rasdl + +.PHONY : test_module +test_module: + cd $(RMANBASE)/rasdl; $(MAKE) + +test_rasdl: test_rasdl.o $(RASDL) + $(CXX) $(LDFLAGS) -o $@ $^ + +######################## Dependencies ############################ + +test_rasdl.o: test_rasdl.cc + +# general rules +include $(RMANBASE)/Makefile.rel + +# automatically created dependencies +include Makefile.dep diff --git a/rasdl/test/basictypes.dl b/rasdl/test/basictypes.dl new file mode 100644 index 0000000..60c9123 --- /dev/null +++ b/rasdl/test/basictypes.dl @@ -0,0 +1,157 @@ +/* +* This file is part of rasdaman community. +* +* Rasdaman community is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Rasdaman community is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with rasdaman community. If not, see <http://www.gnu.org/licenses/>. +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see <http://www.rasdaman.org> +* or contact Peter Baumann via <baumann@rasdaman.com>. +*/ +// --------------------------------------------------------------------- +// +// +// PURPOSE: +// This file contains type definitions to challenge the rasdl utilit. +// Rasdl needs to read them and react appropriately. Reports are done +// to stdout. +// +// +// COMMENTS: +// ./. +// +// +// --------------------------------------------------------------------- + + +// --- good defs ------------------------------------------------------- +// --- bad defs -------------------------------------------------------- + + + +// example 1 +typedef marray <char,2> GreyImage; +typedef set<GreyImage> GreySet; + +// example 2 +typedef marray <boolean,2> BoolImage; +typedef set<BoolImage> BoolSet; + +// example 3 +struct RGBPixel { char red, green, blue; }; +typedef marray <RGBPixel,2> RGBImage; +typedef set<RGBImage> RGBSet; + +// example 4 +typedef marray <unsigned long, 2> ULongImage; +typedef set<ULongImage> ULongSet; + +// example 5 +typedef marray <char, 3> GreyCube; +typedef set<GreyCube> GreySet3; + + +// heavily expanded types (Andreas) +typedef marray <boolean, 1> BoolString; +typedef set<BoolString> BoolSet1; + +typedef marray <boolean, 3> BoolCube; +typedef set<BoolCube> BoolSet3; + +typedef marray <char, 1> GreyString; +typedef set<GreyString> GreySet1; + +typedef marray <octet, 1> OctetString; +typedef set<OctetString> OctetSet1; + +typedef marray <octet, 2> OctetImage; +typedef set<OctetImage> OctetSet; + +typedef marray <octet, 3> OctetCube; +typedef set<OctetCube> OctetSet3; + +typedef marray <short, 1> ShortString; +typedef set<ShortString> ShortSet1; + +typedef marray <short, 2> ShortImage; +typedef set<ShortImage> ShortSet; + +typedef marray <short, 3> ShortCube; +typedef set<ShortCube> ShortSet3; + +typedef marray <unsigned short, 1> UShortString; +typedef set<UShortString> UShortSet1; + +typedef marray <unsigned short, 2> UShortImage; +typedef set<UShortImage> UShortSet; + +typedef marray <unsigned short, 3> UShortCube; +typedef set<UShortCube> UShortSet3; + +typedef marray <long, 1> LongString; +typedef set<LongString> LongSet1; + +typedef marray <long, 2> LongImage; +typedef set<LongImage> LongSet; + +typedef marray <long, 3> LongCube; +typedef set<LongCube> LongSet3; + +typedef marray <unsigned long, 1> ULongString; +typedef set<ULongString> ULongSet1; + +typedef marray <unsigned long, 3> ULongCube; +typedef set<ULongCube> ULongSet3; + +typedef marray <RGBPixel, 1> RGBString; +typedef set<RGBString> RGBSet1; + +typedef marray <RGBPixel, 3> RGBCube; +typedef set<RGBCube> RGBSet3; + +typedef marray <float, 1> FloatString; +typedef set<FloatString> FloatSet1; + +typedef marray <float, 2> FloatImage; +typedef set<FloatImage> FloatSet; + +typedef marray <float, 3> FloatCube; +typedef set<FloatCube> FloatSet3; + +typedef marray <float, 4> FloatCube4; +typedef set<FloatCube4> FloatSet4; + +typedef marray <double, 1> DoubleString; +typedef set<DoubleString> DoubleSet1; + +typedef marray <double, 2> DoubleImage; +typedef set<DoubleImage> DoubleSet; + +typedef marray <double, 3> DoubleCube; +typedef set<DoubleCube> DoubleSet3; + +typedef marray <complex, 1> Gauss1; +typedef set<Gauss1> GaussSet1; + +typedef marray<complexd, 1> Gauss2; +typedef set<Gauss2> GaussSet2; + +typedef marray <complex, 2> Gauss1Image; +typedef set<Gauss1Image> Gauss1Set; + +typedef marray<complexd, 2> Gauss2Image; +typedef set<Gauss2Image> Gauss2Set; + +// --- end ----------------------------------------------------------- diff --git a/rasdl/test/rasdl_test.sh b/rasdl/test/rasdl_test.sh new file mode 100644 index 0000000..c465f3a --- /dev/null +++ b/rasdl/test/rasdl_test.sh @@ -0,0 +1,103 @@ +#!/bin/bash -x +# +# This file is part of rasdaman community. +# +# Rasdaman community is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Rasdaman community is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with rasdaman community. If not, see <http://www.gnu.org/licenses/>. +# +# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +# rasdaman GmbH. +# +# For more information please see <http://www.rasdaman.org> +# or contact Peter Baumann via <baumann@rasdaman.com>. +# +# rasdl_test.sh: test rasdl +# +# COMMENTS: +# - deletes and recreates databases, needs base DBMS up and running +# - FIXME: under work +# - bash -x serves to log command lines +# - has local copy of basictypes.dl; keep consistent! +################################################################## + +# program to be tested +RASDL=../rasdl + +# databases to be used (will be destroyed!) +DB1=TESTDB1 +DB2=TESTDB2 + +echo "$0: start rasdl test." + +# help +$RASDL -h +$RASDL --help + +# unknown parameter +$RASDL --unknown +$RASDL -y + +# inconsistent parameters and options +$RASDL -i +$RASDL --hh headerfile +$RASDL + +# --- from here on we need database connection +# clean starting point, result is of no interest +$RASDL --database $DB1 --deldatabase +$RASDL --database $DB2 --deldatabase + +# --- nonex. db + +#delete nonexisting database +$RASDL --database $DB2 --deldatabase + +# fill into nonexisting database +$RASDL --database $DB2 --read basictypes.dl --insert + +# --- good cases + +# create db, regular +$RASDL --database $DB1 --createdatabase + +# create existing database +$RASDL --database $DB1 --createdatabase + +# fill into existing database +$RASDL --database $DB1 --read basictypes.dl --insert + +# print types +$RASDL --database $DB1 --print + +# generate hh file +rm basictypes.hh +$RASDL --database $DB1 --hh basictypes.hh +# for the diff lateron: +cat basictypes.hh + +# delete base type +$RASDL --database $DB1 --delbasetype char +$RASDL --database $DB1 --print + +# delete MDD type +$RASDL --database $DB1 --delmddtype GreyImage +$RASDL --database $DB1 --print + +# delete set type +$RASDL --database $DB1 --delsettype GreySet +$RASDL --database $DB1 --print + +# delete database (cleanup) +$RASDL --database $DB1 --deldatabase + +echo "$0: rasdl test done." diff --git a/rasdl/test/test_rasdl.cc b/rasdl/test/test_rasdl.cc new file mode 100644 index 0000000..9577168 --- /dev/null +++ b/rasdl/test/test_rasdl.cc @@ -0,0 +1,80 @@ +/* +* This file is part of rasdaman community. +* +* Rasdaman community is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Rasdaman community is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with rasdaman community. If not, see <http://www.gnu.org/licenses/>. +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see <http://www.rasdaman.org> +* or contact Peter Baumann via <baumann@rasdaman.com>. +*/ +// #include <conio.h> +#include <iostream> +#include <stdio.h> +#include <stdlib.h> + +#include "rasdl/symbtbl.hh" +#include "rasdl/yparse.hh" + +extern int yyparse(); +extern FILE *yyin; +extern YSymbolTable *Symbols; + +int main(int argc,char *argv[]) +{ + if(argc!=3) + { + cerr<<"USAGE: odl odl-script cpp-header"; + exit(-1); + }; + + cout<<"--BEGIN-------------------------------------------------------------------------"; + cout<<"opening \""<<argv[1]<<"\"..."; + yyin=fopen(argv[1],"r"); + + if(yyin==NULL) + { + cout<<"fail!\n"; + cerr<<"\nfailed to open "<<argv[1]<<".\n"; + + exit(-1); + }; + + cout<<"ok!\n"; + + cout<<"parsing..."; + yyparse(); + cout<<"done!\n"; + + cout<<"output..."; + + FILE *file=fopen(argv[2],"wt"); + + /* header description */ + fprintf(file,"//------------------------------------------------------------\n"); + fprintf(file,"// automatic created C++-header \n"); + fprintf(file,"//------------------------------------------------------------\n"); + fprintf(file,"\n"); + + Symbols->global_scope->output(file); + + fclose(file); + + cout<<"done!\n"; + cout<<"--END---------------------------------------------------------------------------"; + + return(0); +}; + |