File: version_test.cpp

package info (click to toggle)
mdds 3.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,828 kB
  • sloc: cpp: 21,913; exp: 6,696; makefile: 698; ansic: 616; python: 602; sh: 428; lisp: 8
file content (60 lines) | stat: -rw-r--r-- 1,593 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
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */

// SPDX-FileCopyrightText: 2026 Kohei Yoshida
//
// SPDX-License-Identifier: MIT

#include "test_global.hpp" // This must be the first header to be included.
#include <mdds/version.hpp>

#include <string>

void test_version()
{
    MDDS_TEST_FUNC_SCOPE;

    {
        std::string ver = MDDS_VERSION; // it's a string literal
        std::cout << "version: " << ver << std::endl;

        std::ostringstream os;
        os << MDDS_VERSION_MAJOR << '.' << MDDS_VERSION_MINOR << '.' << MDDS_VERSION_MICRO;
        assert(ver == os.str());
    }

    {
        // make sure these are integer literals
        int ver = MDDS_VERSION_MAJOR;
        std::cout << "major: " << ver << std::endl;
        ver = MDDS_VERSION_MINOR;
        std::cout << "minor: " << ver << std::endl;
        ver = MDDS_VERSION_MICRO;
        std::cout << "micro: " << ver << std::endl;
    }

    {
        std::string ver = MDDS_API_VERSION; // it's a string literal
        std::cout << "API version: " << ver << std::endl;

        std::ostringstream os;
        os << MDDS_API_VERSION_MAJOR << '.' << MDDS_API_VERSION_MINOR;
        assert(ver == os.str());
    }

    {
        // make sure these are integer literals
        int ver = MDDS_API_VERSION_MAJOR;
        std::cout << "API major: " << ver << std::endl;
        ver = MDDS_API_VERSION_MINOR;
        std::cout << "API minor: " << ver << std::endl;
    }
}

int main()
{
    test_version();

    return EXIT_SUCCESS;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */