Develop and Download Open Source Software

Browse CVS Repository

Contents of /xoonips/AL/test/test_session.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Thu Nov 25 09:01:05 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
Changes since 1.1: +9 -2 lines
File MIME type: text/x-c++src
getSessionIDのテストを追加.

1 /*
2 *
3 * session?????鴻?????鴻??
4 *
5 * gcc -o test_session test_session.cc common.cc ../session.cc ../common.cc
6 *
7 * $Revision: 1.1 $
8 * $Log: test_session.cc,v $
9 * Revision 1.1 2004/11/24 06:53:56 youi
10 * initial version
11 *
12 *
13 */
14 #include <time.h>
15 #include <stdio.h>
16 #include <unistd.h>
17 #include <string.h>
18 #include <time.h>
19
20 #include "../session.h"
21 #include "common.h"
22
23 #define TEST( x ) test( x, #x );
24
25 void main( void )
26 {
27 // ?????ゃ?????鴻??
28 session* s = new session( );
29 TEST( s -> getSessionID( ) == 0 );
30 TEST( s -> getRemoteHost( ) == 0 );
31 TEST( s -> getDate( ) == 0 );
32 delete s;
33
34 // ?潟?潟?鴻???????帥?ф??絎?????????????┃絎??????????????????????????鴻??
35 time_t t = time( NULL );
36 s = new session( 0x3e3c0a0a, t ); //10.12.60.62, time()
37 TEST( s -> getRemoteHost( ) == 0x3e3c0a0a );
38 TEST( s -> getDate( ) == t );
39
40 // set?∽?違?у??眼???????????????????????????????????鴻??
41 // set?∽?違??戎???????????祉???激?с??D??紊????????????????????鴻??
42 unsigned long sid = s -> getSessionID( );
43 s -> setRemoteHost( 0x3e010a0a );
44 TEST( s -> getRemoteHost( ) == 0x3e010a0a );
45 TEST( sid != s -> getSessionID( ) );
46
47 sid = s -> getSessionID( );
48 t = time( NULL );
49 sleep( 1 );
50 s -> setDate( t );
51 TEST( s -> getDate( ) == t );
52 TEST( sid != s -> getSessionID( ) );
53
54 s -> setSessionID( sid );
55 TEST( sid == s -> getSessionID( ) );
56
57 delete s;
58 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26