OSDN Git Service

* WorkBackup: 2015/06/23(Tue) AM 05:51 (Testing & DeBugging LibEditText_LineCtrl_Spli...
[drdeamon64/drdeamon64.git] / libedittext / test_libedittext_cursorinfo.c
1 /*DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64
2
3                          D r . D e a m o n  6 4
4                         for INTEL64(R), AMD64(R)
5         
6    Copyright(C) 2007-2009 Koine Yuusuke(koinec). All rights reserved.
7
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met:
10
11  1. Redistributions of source code must retain the above copyright notice,
12     this list of conditions and the following disclaimer.
13  2. Redistributions in binary form must reproduce the above copyright
14     notice, this list of conditions and the following disclaimer in the
15     documentation and/or other materials provided with the distribution.
16
17 THIS SOFTWARE IS PROVIDED BY Koine Yuusuke(koinec) ``AS IS'' AND ANY
18 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 DISCLAIMED. IN NO EVENT SHALL Koine Yuusuke(koinec) OR CONTRIBUTORS BE
21 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
27 OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64*/
30
31 /* File Info -----------------------------------------------------------
32 File: drd64_.c
33 Function: 
34 Comment: 
35 ----------------------------------------------------------------------*/
36
37 #define DRD64_SRC_TEST_LIBEDITTEXT_CURSORINFO
38 #include"test_libedittext.h"
39 #include"drd64_libedittext.h"
40
41
42 /* LibEditText_InitFreeCursor *****************************************/
43 /*--------------------------------------------------------------------*/
44 void Test_LibEditText_API_InitFreeCursor_test00_001(void)
45 {
46         int     i_result;
47         int             i_tinfoid;
48         int             i_curid;
49         
50         i_result        = LibEditText_Init();
51         CU_ASSERT( 0x00 == i_result );
52
53         i_tinfoid       = LibEditText_CreateTextFile( "./testdata", NULL );
54         CU_ASSERT( 0x00 == i_result );
55
56         i_curid = LibEditText_AllocCursor( i_tinfoid, 1 );
57         CU_ASSERT( 0x00 <= i_curid );
58
59         i_result        = LibEditText_FreeCursor( i_tinfoid, i_curid );
60         CU_ASSERT( 0x00 == i_result );
61
62         i_result        = LibEditText_Term();
63         CU_ASSERT( 0x00 == i_result );
64
65         return;
66 }
67
68
69 /*--------------------------------------------------------------------*/
70 void Test_LibEditText_API_InitFreeCursor_test00_002(void)
71 {
72         int     i_result;
73         int             i_tinfoid;
74         int             i_curid[5];
75         
76         i_result        = LibEditText_Init();
77         CU_ASSERT( 0x00 == i_result );
78
79         i_tinfoid       = LibEditText_CreateTextFile( "./testdata", NULL );
80         CU_ASSERT( 0x00 == i_result );
81
82         i_curid[0]      = LibEditText_AllocCursor( i_tinfoid, 1 );
83         CU_ASSERT( 0x00 <= i_curid[0] );
84         i_curid[1]      = LibEditText_AllocCursor( i_tinfoid, 10 );
85         CU_ASSERT( 0x00 <= i_curid[1] );
86         i_curid[2]      = LibEditText_AllocCursor( i_tinfoid, 50 );
87         CU_ASSERT( 0x00 <= i_curid[2] );
88         i_curid[3]      = LibEditText_AllocCursor( i_tinfoid, 100 );
89         CU_ASSERT( 0x00 <= i_curid[3] );
90
91         i_curid[4]      = LibEditText_AllocCursor( i_tinfoid, 5 );
92         CU_ASSERT( 0x00 > i_curid[4] );
93
94         i_result        = LibEditText_FreeCursor( i_tinfoid, i_curid[3] );
95         CU_ASSERT( 0x00 == i_result );
96         i_result        = LibEditText_FreeCursor( i_tinfoid, i_curid[2] );
97         CU_ASSERT( 0x00 == i_result );
98         i_result        = LibEditText_FreeCursor( i_tinfoid, i_curid[1] );
99         CU_ASSERT( 0x00 == i_result );
100         i_result        = LibEditText_FreeCursor( i_tinfoid, i_curid[0] );
101         CU_ASSERT( 0x00 == i_result );
102
103         i_result        = LibEditText_Term();
104         CU_ASSERT( 0x00 == i_result );
105
106         return;
107 }
108
109
110
111
112 /*----------------------------------------------------------------------
113 ----------------------------------------------------------------------*/
114 DRD64_TEST_LIBEDITTEXT_CURSORINFO_EXTERN
115 int
116         Test_LibEditText_CursorInfo(
117                 void )
118 {
119         CU_pSuite       pt_edittext;
120
121         pt_edittext     = CU_add_suite( "LibEditText_CursorInfo", NULL, NULL );
122
123         CU_add_test( pt_edittext, "EditText_API_InitFreeCursor_test00_001",
124                                          Test_LibEditText_API_InitFreeCursor_test00_001 );
125         CU_add_test( pt_edittext, "EditText_API_InitFreeCursor_test00_002",
126                                          Test_LibEditText_API_InitFreeCursor_test00_002 );
127
128
129         return 0x00;
130 }
131
132
133 /* EOF of drd64_.c ----------------------------------- */