File: Test_Algorithm.cpp

package info (click to toggle)
pymol 2.4.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 43,312 kB
  • sloc: cpp: 480,106; python: 79,860; ansic: 28,343; javascript: 6,792; sh: 47; makefile: 30; csh: 8
file content (22 lines) | stat: -rw-r--r-- 466 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
#include <string>

#include "Test.h"

#include "pymol/algorithm.h"

TEST_CASE("Clamp", "[Algorithm]")
{
  REQUIRE(pymol::clamp(-1, 0, 10) == 0);
  REQUIRE(pymol::clamp(3, 0, 10) == 3);
  REQUIRE(pymol::clamp(13, 0, 10) == 10);
}

TEST_CASE("Equal", "[Algorithm]")
{
  std::vector<int> a{1, 2, 3, 4};
  std::vector<int> b{1, 2, 3, 4, 5};
  REQUIRE(pymol::equal(a.begin(), a.end(), b.begin()));
  b[3] = 42;
  REQUIRE(!pymol::equal(a.begin(), a.end(), b.begin()));
}