• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stillwater-sc / universal / 24937806439

25 Apr 2026 06:35PM UTC coverage: 84.326% (-0.007%) from 84.333%
24937806439

Pull #760

github

web-flow
Merge 34ef5e582 into 5182a1d7b
Pull Request #760: feat(internal): blockbinary mul/div/mod constexpr foundation

61 of 81 new or added lines in 3 files covered. (75.31%)

3 existing lines in 1 file now uncovered.

44983 of 53344 relevant lines covered (84.33%)

6356992.83 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

62.5
/internal/blockbinary/api/conversion.cpp
1
//  conversion.cpp : test suite runner for blockbinary construction and conversion of blockbinary
2
//
3
// Copyright (C) 2017 Stillwater Supercomputing, Inc.
4
// SPDX-License-Identifier: MIT
5
//
6
// This file is part of the universal numbers project, which is released under an MIT Open Source license.
7
#include <universal/utility/directives.hpp>
8
#include <universal/utility/long_double.hpp>
9
#include <iostream>
10

11
#include <universal/internal/blockbinary/blockbinary.hpp>
12
#include <universal/verification/test_suite.hpp>
13

14
int main()
1✔
15
try {
16
        using namespace sw::universal;
17

18
        std::string test_suite  = "blockbinary conversion validation";
2✔
19
        std::string test_tag    = "conversion";
1✔
20
        bool reportTestCases    = true;
1✔
21
        int nrOfFailedTestCases = 0;
1✔
22

23
        ReportTestSuiteHeader(test_suite, reportTestCases);
1✔
24

25
        {
26
                // scenario that happens in unrounded add/sub where blockbinary is used as storage type for fraction or significant
27
                constexpr size_t fbits = 8;
1✔
28
                constexpr size_t fhbits = fbits + 1;
1✔
29
                constexpr size_t abits = fhbits + 3;
1✔
30
                constexpr size_t sumbits = abits + 1;
1✔
31
                size_t msbMask = 1;
1✔
32
                blockbinary<fhbits, uint8_t> a;
33
                for (size_t i = 0; i < fbits; ++i) {
9✔
34
                        a.setbits(msbMask);
8✔
35
                        blockbinary<sumbits, uint8_t> b(a);
8✔
36
                        std::cout << to_binary(a, true) << '\n';
8✔
37
                        std::cout << to_binary(b, true) << '\n';
8✔
38
                        msbMask <<= 1;
8✔
39
                }
40
        }
41

42
        ReportTestSuiteResults(test_suite, nrOfFailedTestCases);
1✔
43
        return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS);
1✔
44
}
1✔
NEW
45
catch (char const* msg) {
×
NEW
46
        std::cerr << msg << '\n';
×
NEW
47
        return EXIT_FAILURE;
×
NEW
48
}
×
NEW
49
catch (const std::runtime_error& err) {
×
NEW
50
        std::cerr << "Uncaught runtime exception: " << err.what() << std::endl;
×
NEW
51
        return EXIT_FAILURE;
×
NEW
52
}
×
NEW
53
catch (...) {
×
NEW
54
        std::cerr << "Caught unknown exception" << '\n';
×
NEW
55
        return EXIT_FAILURE;
×
NEW
56
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc