~mysql/mysql-server/mysql-6.0

« back to all changes in this revision

Viewing changes to innobase/dyn/ts/tsdyn.c

  • Committer: monty at mysql
  • Date: 2001-02-17 12:19:19 UTC
  • mto: (554.1.1)
  • mto: This revision was merged to the branch mainline in revision 556.
  • Revision ID: sp1r-monty@donna.mysql.com-20010217121919-07904
Added Innobase to source distribution

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/************************************************************************
 
2
The test module for dynamic array
 
3
 
 
4
(c) 1996 Innobase Oy
 
5
 
 
6
Created 2/5/1996 Heikki Tuuri
 
7
*************************************************************************/
 
8
 
 
9
#include "../dyn0dyn.h"
 
10
#include "sync0sync.h"
 
11
#include "mem0mem.h"
 
12
 
 
13
/****************************************************************
 
14
Basic test. */
 
15
 
 
16
void
 
17
test1(void)
 
18
/*=======*/
 
19
{
 
20
        dyn_array_t     dyn;
 
21
        ulint           i;
 
22
        ulint*          ulint_ptr;
 
23
 
 
24
        printf("-------------------------------------------\n");
 
25
        printf("TEST 1. Basic test\n");
 
26
 
 
27
        dyn_array_create(&dyn);
 
28
 
 
29
        for (i = 0; i < 1000; i++) {
 
30
                ulint_ptr = dyn_array_push(&dyn, sizeof(ulint));
 
31
                *ulint_ptr = i;
 
32
        }
 
33
 
 
34
        ut_a(dyn_array_get_n_elements(&dyn) == 1000);
 
35
 
 
36
        for (i = 0; i < 1000; i++) {
 
37
                ulint_ptr = dyn_array_get_nth_element(&dyn, i, sizeof(ulint));
 
38
                ut_a(*ulint_ptr == i);
 
39
        }
 
40
 
 
41
        dyn_array_free(&dyn);
 
42
}
 
43
 
 
44
void 
 
45
main(void) 
 
46
{
 
47
        sync_init();
 
48
        mem_init();
 
49
 
 
50
        test1();
 
51
        
 
52
        ut_ad(sync_all_freed());
 
53
 
 
54
        ut_ad(mem_all_freed());
 
55
        
 
56
        printf("TEST SUCCESSFULLY COMPLETED!\n");
 
57