1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
|
This directory contains unit tests and client/server tests.
Unit tests are language-specific.
This file describes the client/server tests.
The server is implemented in C/server.c. It runs continuously while the client
tests for each language are run one at a time. Each client test issues a set
of requests to the server, and checks the replies it receives.
1. Echo test
============
This tests basic message transmission, without any marshalling.
Client publishes a random set of mmessages to the "TEST_ECHO" channel and
listens for replies on "TEST_ECHO_REPLY". The replies should be identical to
the transmitted messages, and should be received within 1 s of transmission.
2. primitives_t test
=================
This tests primitive data types, fixed length primitive arrays, and
variable-length primitive arrays.
Client publishes 1000 lcmtest.primitives_t messages to channel
"test_lcmtest_primitives_t". Message number n should be populated as follows for
n from 0 to 999:
.i8 = n % 100
.i16 = n * 10
.i64 = n * 10000
.position[0] = n
.position[1] = n
.position[2] = n
.orientation[0] = n
.orientation[1] = n
.orientation[2] = n
.orientation[3] = n
.num_ranges = n
.ranges[i] = i (i = 0 ... n-1)
.name = <string representation of n>
.enabled = n % 2
The server should reply to each message with an lcmtest.primitives_t message on
channel "test_lcmtest_primitives_t_reply". The reply should be populated as
follows:
.i8 = (n + 1) % 100
.i16 = (n + 1) * 10
.i64 = (n + 1) * 10000
.position[0] = n + 1
.position[1] = n + 1
.position[2] = n + 1
.orientation[0] = n + 1
.orientation[1] = n + 1
.orientation[2] = n + 1
.orientation[3] = n + 1
.num_ranges = n + 1
.ranges[i] = i (i = 0 ... n-1)
.name = <string representation of n+1>
.enabled = (n+1) % 2
3. example_list_t
=================
This tests nested datatypes.
Client publishes 100 lcmtest.example_list_t messages to channel
"test_lcmtest_example_list_t". Message number n should be populated as
follows, for n from 0 to 99:
.n = n
.examples[i] = { (i = 0 ... n-1)
.i8 = -(i % 100)
.i16 = -(i * 10)
.i64 = -(i * 10000)
.position[0] = -i
.position[1] = -i
.position[2] = -i
.orientation[0] = -i
.orientation[1] = -i
.orientation[2] = -i
.orientation[3] = -i
.num_ranges = i
.ranges[j] = -j (j = 0 ... i-1)
.name = <string representation of -i>
.enabled = i % 2
}
The server should reply to each message with an lcmtest.example_list_t message on
channel "test_lcmtest_example_list_t_reply". The reply should be populated as
follows:
.n = n + 1
.examples[i] = { (i = 0 ... n)
.i8 = -(i % 100)
.i16 = -(i * 10)
.i64 = -(i * 10000)
.timestamp = -i
.position[0] = -i
.position[1] = -i
.position[2] = -i
.orientation[0] = -i
.orientation[1] = -i
.orientation[2] = -i
.orientation[3] = -i
.num_ranges = i
.ranges[j] = -j (j = 0 ... i-1)
.name = <string representation of -i>
.enabled = i % 2
}
4. node_t
=========
This tests recursive data types.
Client publishes 7 lcmtest.node_t messages to channel "test_lcmtest_node_t".
Message number n should be populated as follows, for n from 0 to 6:
.num_children = n
.children[i] = { (i = 0 ... n-1)
.num_children = n - 1
.children[j] = { (j = 0 ... n-2)
.num_children = n-2
.children[k] = { (k = 0 ... n-3)
.
.
.
.children[m] = {
.num_children = 0
}
}
}
}
Thus, the client message is a tree of height n, where the root node has n
children, and each node has one fewer child than its parent.
The server should reply to each message with an lcmtest.node_t message on
channel "test_lcmtest_node_t_reply". The reply should be similar to
the client message, but with a tree height of (n+1).
5. multidim_array_t
===================
This tests multidimensional arrays.
Client publishes 5 lcmtest.multidim_array_t messages to channel
"test_lcmtest_multidim_array_t". Message number n should be populated as
follows, for n from 0 to 4:
.size_a = n
.size_b = n
.size_c = n
.data[i][j][k] = i*n*n + j*n + k (i, j, k = 0 .. n-1)
.strarray[p][q] = <string repreesentation of p*n + q>
(p = { 0, 1 }, q = 0 .. n-1)
The server should reply to each message with an lcmtest.multidim_array_t
message on channel "test_lcmtest_multidim_array_t_reply". The reply should be
similar to the client message, but with as if the client was on message (n+1).
5. cross_package_t
===================
This tests nested datatypes crossing package boundaries.
Client publishes 1000 lcmtest2.cross_package_t messages to channel
"test_lcmtest2_cross_package_t". Message number n should be populated as follows for
n from 0 to 999:
.primitives.i8 = n % 100
.primitives.i16 = n * 10
.primitives.i64 = n * 10000
.primitives.position[0] = n
.primitives.position[1] = n
.primitives.position[2] = n
.primitives.orientation[0] = n
.primitives.orientation[1] = n
.primitives.orientation[2] = n
.primitives.orientation[3] = n
.primitives.num_ranges = n
.primitives.ranges[i] = i (i = 0 ... n-1)
.primitives.name = <string representation of n>
.primitives.enabled = n % 2
.another.val = n
The server should reply to each message with an lcmtest2.cross_package_t message on
channel "test_lcmtest2_cross_package_t". The reply should be populated as
follows:
.primitives.i8 = (n + 1) % 100
.primitives.i16 = (n + 1) * 10
.primitives.i64 = (n + 1) * 10000
.primitives.position[0] = n + 1
.primitives.position[1] = n + 1
.primitives.position[2] = n + 1
.primitives.orientation[0] = n + 1
.primitives.orientation[1] = n + 1
.primitives.orientation[2] = n + 1
.primitives.orientation[3] = n + 1
.primitives.num_ranges = n + 1
.primitives.ranges[i] = i (i = 0 ... n-1)
.primitives.name = <string representation of n+1>
.primitives.enabled = (n+1) % 2
.another.val = n + 1
|