File: test_utils.cpp

package info (click to toggle)
slic3r-prusa 2.9.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 196,524 kB
  • sloc: cpp: 534,736; ansic: 71,269; yacc: 1,311; makefile: 256; lex: 241; sh: 113
file content (35 lines) | stat: -rw-r--r-- 1,089 bytes parent folder | download | duplicates (2)
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
#include <catch2/catch_test_macros.hpp>

#include "libslic3r/libslic3r.h"

SCENARIO("Test fast_round_up()") {
    using namespace Slic3r;

    THEN("fast_round_up<int>(1.5) is 2") {
        REQUIRE(fast_round_up<int>(1.5) == 2);
    }
    THEN("fast_round_up<int>(1.499999999999999) is 1") {
        REQUIRE(fast_round_up<int>(1.499999999999999) == 1);
    }
    THEN("fast_round_up<int>(0.5) is 1") {
        REQUIRE(fast_round_up<int>(0.5) == 1);
    }
    THEN("fast_round_up<int>(0.49999999999999994) is 0") {
        REQUIRE(fast_round_up<int>(0.49999999999999994) == 0);
    }
    THEN("fast_round_up<int>(-0.5) is 0") {
        REQUIRE(fast_round_up<int>(-0.5) == 0);
    }
    THEN("fast_round_up<int>(-0.51) is -1") {
        REQUIRE(fast_round_up<int>(-0.51) == -1);
    }
    THEN("fast_round_up<int>(-0.51) is -1") {
        REQUIRE(fast_round_up<int>(-0.51) == -1);
    }
    THEN("fast_round_up<int>(-1.5) is -1") {
        REQUIRE(fast_round_up<int>(-1.5) == -1);
    }
    THEN("fast_round_up<int>(-1.51) is -2") {
        REQUIRE(fast_round_up<int>(-1.51) == -2);
    }
}