148 lines
4.4 KiB
Plaintext
148 lines
4.4 KiB
Plaintext
|
|
#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 = <text>Test</text--->;
|
||
|
|
let tt3 = 'Test<text>Test</text--->Test';
|
||
|
|
let tt4 = <text>Test'Test'Test</text--->;
|
||
|
|
let tt5 = <text>Test'Test'Test<text>Test</text--->;
|
||
|
|
let tt6 = 'test/Test';
|
||
|
|
let tt7 = <text>Test\Test\Test</text--->;
|
||
|
|
let tt8 = <text>Test\<text>Test\Test\</text--->Test</text--->;
|
||
|
|
let tt9 = 'Test\<text>Test\Test\</text--->Test';
|
||
|
|
let tt10 = <text>Test\\<text>Test\\Test\</text--->Test</text--->;
|
||
|
|
let tt11 = 'Test\\<text>Test\\Test\\</text--->Test';
|
||
|
|
let tt12 = 'Test\\';
|
||
|
|
let tt13 = <text>Test\\</text--->;
|
||
|
|
|
||
|
|
let tt101 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz /*-+^!"$%&/()=?\\\'<>|,.;:_~#{}[]@';
|
||
|
|
|
||
|
|
save database to 'ftexttest';
|
||
|
|
close database;
|
||
|
|
restore database ftexttest from 'ftexttest';
|
||
|
|
|
||
|
|
###########################
|
||
|
|
# In/Out Function #
|
||
|
|
###########################
|
||
|
|
|
||
|
|
#testcase InOut1
|
||
|
|
#yields (bool TRUE)
|
||
|
|
query tt2 = <text>Test</text--->
|
||
|
|
|
||
|
|
#testcase InOut2
|
||
|
|
#yields (bool TRUE)
|
||
|
|
query tt2 = <text>Test</text--->
|
||
|
|
|
||
|
|
#testcase InOut3
|
||
|
|
#yields (bool TRUE)
|
||
|
|
query tt3 = 'Test<text>Test</text--->Test'
|
||
|
|
|
||
|
|
#testcase InOut4
|
||
|
|
#yields (bool TRUE)
|
||
|
|
query tt4 = <text>Test'Test'Test</text--->
|
||
|
|
|
||
|
|
#testcase InOut5
|
||
|
|
#yields (bool TRUE)
|
||
|
|
query tt5 = <text>Test'Test'Test<text>Test</text--->
|
||
|
|
|
||
|
|
#testcase InOut6
|
||
|
|
#yields (bool TRUE)
|
||
|
|
query tt6 = 'test/Test'
|
||
|
|
|
||
|
|
#testcase InOut7
|
||
|
|
#yields (bool TRUE)
|
||
|
|
query tt7 = <text>Test\Test\Test</text--->
|
||
|
|
|
||
|
|
#testcase InOut8
|
||
|
|
#yields (bool TRUE)
|
||
|
|
query tt8 = <text>Test\<text>Test\Test\</text--->Test</text--->
|
||
|
|
|
||
|
|
#testcase InOut9
|
||
|
|
#yields (bool TRUE)
|
||
|
|
query tt9 = 'Test\<text>Test\Test\</text--->Test'
|
||
|
|
|
||
|
|
#testcase InOut10
|
||
|
|
#yields (bool TRUE)
|
||
|
|
query tt10 = <text>Test\\<text>Test\\Test\</text--->Test</text--->
|
||
|
|
|
||
|
|
#testcase InOut11
|
||
|
|
#yields (bool TRUE)
|
||
|
|
query tt11 = 'Test\\<text>Test\\Test\\</text--->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
|