~ubuntu-branches/ubuntu/utopic/gridengine/utopic

« back to all changes in this revision

Viewing changes to source/libs/comm/lists/test_cl_parameter_list.c

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-25 22:36:13 UTC
  • Revision ID: james.westby@ubuntu.com-20080625223613-tvd9xlhuoct9kyhm
Tags: upstream-6.2~beta2
ImportĀ upstreamĀ versionĀ 6.2~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/*___INFO__MARK_BEGIN__*/
 
3
/*************************************************************************
 
4
 * 
 
5
 *  The Contents of this file are made available subject to the terms of
 
6
 *  the Sun Industry Standards Source License Version 1.2
 
7
 * 
 
8
 *  Sun Microsystems Inc., March, 2001
 
9
 * 
 
10
 * 
 
11
 *  Sun Industry Standards Source License Version 1.2
 
12
 *  =================================================
 
13
 *  The contents of this file are subject to the Sun Industry Standards
 
14
 *  Source License Version 1.2 (the "License"); You may not use this file
 
15
 *  except in compliance with the License. You may obtain a copy of the
 
16
 *  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
 
17
 * 
 
18
 *  Software provided under this License is provided on an "AS IS" basis,
 
19
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 
20
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 
21
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 
22
 *  See the License for the specific provisions governing your rights and
 
23
 *  obligations concerning the Software.
 
24
 * 
 
25
 *   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 
26
 * 
 
27
 *   Copyright: 2001 by Sun Microsystems, Inc.
 
28
 * 
 
29
 *   All Rights Reserved.
 
30
 * 
 
31
 ************************************************************************/
 
32
/*___INFO__MARK_END__*/
 
33
 
 
34
#include <stdio.h>
 
35
#include <string.h>
 
36
#include <sys/time.h>
 
37
#include <stdlib.h>
 
38
 
 
39
#include "cl_parameter_list.h"
 
40
 
 
41
#ifdef __CL_FUNCTION__
 
42
#undef __CL_FUNCTION__
 
43
#endif
 
44
#define __CL_FUNCTION__ "main()"
 
45
extern int main(void)
 
46
{
 
47
  int ret;
 
48
  char* param1 = "param1";
 
49
  char* param2 = "param2";
 
50
  char* param3 = "param3";
 
51
  char* val1 = "val1";
 
52
  char* val2 = "val2";
 
53
  char* val3 = "val3";
 
54
 
 
55
  cl_raw_list_t* my_parameter_list = NULL;
 
56
  cl_parameter_list_elem_t* elem = NULL;
 
57
 
 
58
 
 
59
  printf("testing parameter list ...\n");
 
60
  if ((ret=cl_parameter_list_setup(&my_parameter_list,"parameter_list")) != CL_RETVAL_OK) {
 
61
     printf("error: cl_parameter_list_setup(): %d\n", ret);
 
62
     exit(1);
 
63
  }
 
64
 
 
65
  printf("nr of elems: %ld\n", cl_raw_list_get_elem_count(my_parameter_list));   
 
66
  for (elem = cl_parameter_list_get_first_elem(my_parameter_list); elem != NULL ; elem = cl_parameter_list_get_next_elem(elem) ) {
 
67
     printf("parameter: %s\n",elem->parameter);
 
68
     printf("value: %s\n",elem->value);
 
69
  }
 
70
 
 
71
  printf("\nappend parameter ...\n");
 
72
  if ((ret=cl_parameter_list_append_parameter(my_parameter_list, param1, val1, 1)) != CL_RETVAL_OK) {
 
73
     printf("error: cl_parameter_list_append_parameter(): %d\n", ret);
 
74
     exit(1);
 
75
  }
 
76
 
 
77
  printf("nr of elems: %ld\n", cl_raw_list_get_elem_count(my_parameter_list));   
 
78
  for (elem = cl_parameter_list_get_first_elem(my_parameter_list); elem != NULL ; elem = cl_parameter_list_get_next_elem(elem) ) {
 
79
     printf("Print elements:\n");
 
80
     printf("parameter: %s\n",elem->parameter);
 
81
     printf("value: %s\n",elem->value);
 
82
  }
 
83
 
 
84
  printf("\nappend parameter ...\n");
 
85
  if ((ret=cl_parameter_list_append_parameter(my_parameter_list, param2, val2, 1)) != CL_RETVAL_OK) {
 
86
     printf("error: cl_parameter_list_append_parameter(): %d\n", ret);
 
87
     exit(1);
 
88
  }
 
89
 
 
90
  printf("nr of elems: %ld\n", cl_raw_list_get_elem_count(my_parameter_list));   
 
91
  for (elem = cl_parameter_list_get_first_elem(my_parameter_list); elem != NULL ; elem = cl_parameter_list_get_next_elem(elem) ) {
 
92
     printf("Print elements:\n");
 
93
     printf("parameter: %s\n",elem->parameter);
 
94
     printf("value: %s\n",elem->value);
 
95
  }
 
96
 
 
97
  printf("\nappend parameter ...\n");
 
98
  if ((ret=cl_parameter_list_append_parameter(my_parameter_list, param3, val3, 1)) != CL_RETVAL_OK) {
 
99
     printf("error: cl_parameter_list_append_parameter(): %d\n", ret);
 
100
     exit(1);
 
101
  }
 
102
 
 
103
  printf("nr of elems: %ld\n", cl_raw_list_get_elem_count(my_parameter_list));   
 
104
  for (elem = cl_parameter_list_get_first_elem(my_parameter_list); elem != NULL ; elem = cl_parameter_list_get_next_elem(elem) ) {
 
105
     printf("Print elements:\n");
 
106
     printf("parameter: %s\n",elem->parameter);
 
107
     printf("value: %s\n",elem->value);
 
108
  }
 
109
 
 
110
  printf("\nremove parameter ...\n");
 
111
  if ((ret=cl_parameter_list_remove_parameter(my_parameter_list, param2, 1)) != CL_RETVAL_OK) {
 
112
     printf("error: cl_parameter_list_remove_parameter(): %d\n", ret);
 
113
     exit(1);
 
114
  }
 
115
 
 
116
  printf("nr of elems: %ld\n", cl_raw_list_get_elem_count(my_parameter_list));   
 
117
 
 
118
  for (elem = cl_parameter_list_get_first_elem(my_parameter_list); elem != NULL ; elem = cl_parameter_list_get_next_elem(elem) ) {
 
119
     printf("Print elements:\n");
 
120
     printf("parameter: %s\n",elem->parameter);
 
121
     printf("value: %s\n",elem->value);
 
122
  }
 
123
 
 
124
  
 
125
  printf("\ncleanup parameter list ...\n");
 
126
  if ((ret=cl_parameter_list_cleanup(&my_parameter_list)) != CL_RETVAL_OK) {
 
127
     printf("error: cl_parameter_list_cleanup(): %d\n", ret);
 
128
     exit(1);
 
129
  }
 
130
 
 
131
  printf("main done\n");
 
132
 
 
133
  return 0;
 
134
}
 
135
 
 
136