#This file is part of SECONDO. # #Copyright (C) 2004, University in Hagen, Department of Computer Science, #Database Systems for New Applications. # #SECONDO 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 2 of the License, or #(at your option) any later version. # #SECONDO 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 SECONDO; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ######################################################################### # Testing the FTextAlgebra # # Written March 2008 by Christian Duentgen # # run with : TestRunner -c SecondoConfig.ini < ftext.test ######################################################################### # clean up what may be left over from e.g. a segfault delete database ftexttest; ######################## # set up test database # ######################## #setup create database ftexttest; open database ftexttest; let tt1 = 'Test'; let tt2 = Test; let tt3 = 'TestTestTest'; let tt4 = Test'Test'Test; let tt5 = Test'Test'TestTest; let tt6 = 'test/Test'; let tt7 = Test\Test\Test; let tt8 = Test\Test\Test\Test; let tt9 = 'Test\Test\Test\Test'; let tt10 = Test\\Test\\Test\Test; let tt11 = 'Test\\Test\\Test\\Test'; let tt12 = 'Test\\'; let tt13 = Test\\; let tt101 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz /*-+^!"$%&/()=?\\\'<>|,.;:_~#{}[]@'; save database to 'ftexttest'; close database; restore database ftexttest from 'ftexttest'; ########################### # In/Out Function # ########################### #testcase InOut1 #yields (bool TRUE) query tt2 = Test #testcase InOut2 #yields (bool TRUE) query tt2 = Test #testcase InOut3 #yields (bool TRUE) query tt3 = 'TestTestTest' #testcase InOut4 #yields (bool TRUE) query tt4 = Test'Test'Test #testcase InOut5 #yields (bool TRUE) query tt5 = Test'Test'TestTest #testcase InOut6 #yields (bool TRUE) query tt6 = 'test/Test' #testcase InOut7 #yields (bool TRUE) query tt7 = Test\Test\Test #testcase InOut8 #yields (bool TRUE) query tt8 = Test\Test\Test\Test #testcase InOut9 #yields (bool TRUE) query tt9 = 'Test\Test\Test\Test' #testcase InOut10 #yields (bool TRUE) query tt10 = Test\\Test\\Test\Test #testcase InOut11 #yields (bool TRUE) query tt11 = 'Test\\Test\\Test\\Test' #testcase InOut11 #yields (int 95) query length(tt101) #testcase EqSaved #yields (bool TRUE) query tt101 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz /*-+^!"$%&/()=?\\\'<>|,.;:_~#{}[]@' #testcase CompareRepresentations #yields (bool TRUE) query (tt12 = tt13) and (tt13 = 'Test\\') ########################### # Operators # ########################### #testcase getTypeNL #yields (int 100000) query intstream(1, 100000) use[fun(II: int) num2string(II) getTypeNL] transformstream tconsume count #testcase toObject1 #yields ((vector(vector int)) ((9 8 7 6 5 4 3 2 1)()(-1 -2 -3 -4 5 6)(6956356 -64841))) query toObject('((9 8 7 6 5 4 3 2 1)()(-1 -2 -3 -4 5 6)(6956356 -64841))',[const vector(vector(int)) value ()]) #testcase evaluate1 #yields (int 500500) query intstream(1,1000) transformstream extend[MyQuery: 'intstream(1, ' + num2string(.Elem) + ') count'] projecttransformstream[MyQuery] use[fun(MQ: text) evaluate(MQ) projecttransformstream[Result] ] use[fun(MR: text) toObject(MR,0)] transformstream sum[Elem] #testcase combinedTest_getVlaueNL_getTypeNL #yields (int 10000) query intstream(1, 10000) use[fun(II: int) num2string(II) within[ (. getTypeNL) + ": " + (. getValueNL)]] transformstream tconsume count ############################ # mopping up test database # ############################ #teardown close database; delete database ftexttest