File: version.c

package info (click to toggle)
libapreq2 2.13-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 5,652 kB
  • sloc: sh: 9,383; ansic: 8,039; perl: 5,830; cpp: 380; makefile: 284
file content (69 lines) | stat: -rw-r--r-- 1,929 bytes parent folder | download | duplicates (6)
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
/*
**  Licensed to the Apache Software Foundation (ASF) under one or more
** contributor license agreements.  See the NOTICE file distributed with
** this work for additional information regarding copyright ownership.
** The ASF licenses this file to You under the Apache License, Version 2.0
** (the "License"); you may not use this file except in compliance with
** the License.  You may obtain a copy of the License at
**
**      http://www.apache.org/licenses/LICENSE-2.0
**
**  Unless required by applicable law or agreed to in writing, software
**  distributed under the License is distributed on an "AS IS" BASIS,
**  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
**  See the License for the specific language governing permissions and
**  limitations under the License.
*/

#include "apreq_version.h"
#include "at.h"

static void version_string(dAT)
{
    const char *vstring = apreq_version_string();
    AT_not_null(vstring);
    AT_str_eq(vstring, APREQ_VERSION_STRING);
}
static void version_type(dAT)
{
    apr_version_t v;
    apreq_version(&v);
    AT_int_eq(v.major, APREQ_MAJOR_VERSION);
    AT_int_eq(v.minor, APREQ_MINOR_VERSION);
    AT_int_eq(v.patch, APREQ_PATCH_VERSION);
#ifdef APREQ_IS_DEV_VERSION
    AT_int_eq(v.is_dev, 1);
#else
    AT_int_eq(v.is_dev, 0);
#endif
}

int main(int argc, char *argv[])
{
    apr_pool_t *p;
    unsigned i, plan = 0;
    dAT;
    at_test_t test_list [] = {
        {"version_string", version_string, 2, "1"},
        {"version_type", version_type, 4}
    };

    apr_initialize();
    atexit(apr_terminate);

    apr_pool_create(&p, NULL);

    AT = at_create(p, 0, at_report_stdout_make(p));

    for (i = 0; i < sizeof(test_list) / sizeof(at_test_t);  ++i)
        plan += test_list[i].plan;

    AT_begin(plan);

    for (i = 0; i < sizeof(test_list) / sizeof(at_test_t);  ++i)
        AT_run(&test_list[i]);

    AT_end();

    return 0;
}