File: version.c

package info (click to toggle)
libapreq2-perl 2.04-dev-1sarge2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,700 kB
  • ctags: 1,508
  • sloc: sh: 8,103; ansic: 5,557; perl: 2,842; cpp: 1,052; makefile: 234
file content (62 lines) | stat: -rw-r--r-- 1,707 bytes parent folder | download
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
/*
**  Copyright 2003-2004  The Apache Software Foundation
**
**  Licensed 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 "test_apreq.h"
#include "apreq.h"

apr_version_t v;
const char *vstring;

static void version_string(CuTest *tc)
{
    vstring = apreq_version_string();
    CuAssertPtrNotNull(tc, vstring);
    CuAssertStrEquals(tc, APREQ_VERSION_STRING, vstring);
}
static void version_major(CuTest *tc)
{
    apreq_version(&v);
    CuAssertIntEquals(tc, APREQ_MAJOR_VERSION, v.major);
}
static void version_minor(CuTest *tc)
{
    CuAssertIntEquals(tc, APREQ_MINOR_VERSION, v.minor);
}
static void version_patch(CuTest *tc)
{
    CuAssertIntEquals(tc, APREQ_PATCH_VERSION, v.patch);
}
static void version_is_dev(CuTest *tc)
{
#ifdef APREQ_IS_DEV_VERSION
    CuAssertIntEquals(tc, 1, v.is_dev);
#else
    CuAssertIntEquals(tc, 0, v.is_dev);
#endif
}

CuSuite *testversion(void)
{
    CuSuite *suite = CuSuiteNew("Version");
    SUITE_ADD_TEST(suite, version_string);
    SUITE_ADD_TEST(suite, version_major);
    SUITE_ADD_TEST(suite, version_minor);
    SUITE_ADD_TEST(suite, version_patch);
    SUITE_ADD_TEST(suite, version_is_dev);
    return suite;
}