[go: up one dir, main page]

File: EulerKEV.cpp

package info (click to toggle)
libformfactor 0.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,288 kB
  • sloc: cpp: 17,289; python: 382; makefile: 15
file content (42 lines) | stat: -rw-r--r-- 1,215 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
//! Used to test the function ff::atomic::kev
#include "ff/EulerOperations.h"
#include "ff/Face.h"
#include "ff/Make.h"
#include "ff/Polyhedron.h"
#include "ff/Topology.h"
#include "test/3rdparty/catch.hpp"

namespace {
ff::Box* cube = ff::make::Box(2, 2, 2);
}

//! Tests whether kev throws with invalid input

TEST_CASE("KEV:ThrowsInvalidIds", "")
{
    CHECK_THROWS(ff::atomic::kev(ff::Polyhedron({{}, true}, {}), -1, 1));
    CHECK_THROWS(ff::atomic::kev(ff::Polyhedron({{}, true}, {}), 1, -1));
    CHECK_THROWS(ff::atomic::kev(ff::Polyhedron({{}, true}, {}), 1, 100));
    CHECK_THROWS(ff::atomic::kev(ff::Polyhedron({{}, true}, {}), 100, 1));
}

//! Test whether vertex will get removed

TEST_CASE("KEV:UnusedVertexRemoved", "")
{
    ff::Polyhedron* p = ff::atomic::kev(*cube->asPolyhedron(), 0, 1);
    CHECK(p->vertices().size() == 7);
    CHECK(p->faces().size() == 6);
}

//! Ensure that multiple kev will work without creating exceptions

TEST_CASE("KEV:MultipleOperations", "")
{
    ff::Polyhedron* p;
    p = ff::atomic::kev(*cube->asPolyhedron(), 0, 1);
    p = ff::atomic::kev(*p, 0, 2);
    p = ff::atomic::kev(*p, 0, 2);
    CHECK(p->vertices().size() == 5);
    CHECK(p->faces().size() == 4);
}