Browse CVS Repository
Contents of /xoonips/AL/test/test_criteria.cc
Parent Directory
| Revision Log
| Revision Graph
Revision 1.1 -
( show annotations)
( download)
( as text)
Wed Nov 24 06:54:44 2004 UTC
(19 years, 4 months ago)
by youi
Branch: MAIN
CVS Tags: mv_to_sourceforge_20050217, AL_PORTING, MergePnt_20051116, REL20051226, XOONIPS_RC1, REL20060323, tag20060615, tag20070307current, tag20061115, MergePnt_20051220, tag20061130, merge_to_20060605, tag20070307, REL20060213, RELENG_2_0_0a_RELEASE, RELEASE_1_0_0, RELEASE_1_0_1, demo20050128, tag20060622, merge_to_20060411, HEAD
Branch point for: XOONIPS_STABLE_32, XOONIPS_STABLE, XOONIPS_STABLE_3, XOONIPS_STABLE_2
File MIME type: text/x-c++src
initial version
| 1 |
/* |
| 2 |
* criteriaクラスのテスト |
| 3 |
* |
| 4 |
* gcc -o test_criteria test_criteria.cc common.cc ../criteria.cc ../common.cc |
| 5 |
* |
| 6 |
* $Revision$ |
| 7 |
* $Log$ |
| 8 |
* |
| 9 |
*/ |
| 10 |
#include <stdio.h> |
| 11 |
#include <string.h> |
| 12 |
#include <time.h> |
| 13 |
|
| 14 |
#include "../criteria.h" |
| 15 |
#include "common.h" |
| 16 |
|
| 17 |
#define TEST( x ) test( x, #x ); |
| 18 |
|
| 19 |
void main( void ) |
| 20 |
{ |
| 21 |
criteria* c = new criteria( ); |
| 22 |
|
| 23 |
c -> setLimit( 100, 10 ); |
| 24 |
TEST( c -> getLimitStart( ) == 100 ); |
| 25 |
TEST( c -> getLimitRows( ) == 10 ); |
| 26 |
|
| 27 |
TEST( c -> headOrderBy( ) == 0 ); |
| 28 |
TEST( c -> nextOrderBy( ) == 0 ); |
| 29 |
|
| 30 |
c -> addOrderBy( new orderby( "col1", orderby::ASC ) ); |
| 31 |
c -> addOrderBy( new orderby( "col2", orderby::DESC ) ); |
| 32 |
c -> addOrderBy( new orderby( "col3", orderby::ASC ) ); |
| 33 |
|
| 34 |
TEST( strcmp( c -> headOrderBy( ) -> getColumn( ), "col1" ) == 0 ); |
| 35 |
TEST( c -> headOrderBy( ) -> getOrder( ) == orderby::ASC ); |
| 36 |
|
| 37 |
const orderby* odrby_2nd = c -> nextOrderBy( ); |
| 38 |
const orderby* odrby_3rd = c -> nextOrderBy( ); |
| 39 |
const orderby* odrby_4th = c -> nextOrderBy( ); |
| 40 |
TEST( strcmp( odrby_2nd -> getColumn( ), "col2" ) == 0 ); |
| 41 |
TEST( odrby_2nd -> getOrder( ) == orderby::DESC ); |
| 42 |
TEST( strcmp( odrby_3rd -> getColumn( ), "col3" ) == 0 ); |
| 43 |
TEST( odrby_3rd -> getOrder( ) == orderby::ASC ); |
| 44 |
TEST( odrby_4th == 0 ); |
| 45 |
|
| 46 |
c -> clearAll( ); |
| 47 |
TEST( c -> getLimitStart( ) == 0 ); |
| 48 |
TEST( c -> getLimitRows( ) == 0 ); |
| 49 |
TEST( c -> headOrderBy( ) == 0 ); |
| 50 |
TEST( c -> nextOrderBy( ) == 0 ); |
| 51 |
|
| 52 |
delete c; |
| 53 |
} |
| |