blob: 716861665b5a55b8cc6da5d5da011cd7e7b8c186 [file] [log] [blame]
ctiller5e04b132014-12-15 09:24:43 -08001/*
2 *
3 * Copyright 2014, Google Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following disclaimer
14 * in the documentation and/or other materials provided with the
15 * distribution.
16 * * Neither the name of Google Inc. nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 */
33
34#include <grpc/support/useful.h>
35#include <grpc/support/port_platform.h>
36#include <grpc/support/log.h>
37#include "test/core/util/test_config.h"
38
39int main(int argc, char **argv) {
40 int four[4];
41 int five[5];
42 grpc_test_init(argc, argv);
43
44 GPR_ASSERT(GPR_MIN(1, 2) == 1);
45 GPR_ASSERT(GPR_MAX(1, 2) == 2);
46 GPR_ASSERT(GPR_MIN(2, 1) == 1);
47 GPR_ASSERT(GPR_MAX(2, 1) == 2);
48 GPR_ASSERT(GPR_CLAMP(1, 0, 2) == 1);
49 GPR_ASSERT(GPR_CLAMP(0, 0, 2) == 0);
50 GPR_ASSERT(GPR_CLAMP(2, 0, 2) == 2);
51 GPR_ASSERT(GPR_CLAMP(-1, 0, 2) == 0);
52 GPR_ASSERT(GPR_CLAMP(3, 0, 2) == 2);
53 GPR_ASSERT(GPR_ROTL((gpr_uint32)0x80000001, 1) == 3);
54 GPR_ASSERT(GPR_ROTR((gpr_uint32)0x80000001, 1) == 0xc0000000);
55 GPR_ASSERT(GPR_ARRAY_SIZE(four) == 4);
56 GPR_ASSERT(GPR_ARRAY_SIZE(five) == 5);
57
58 return 0;
59}