GaitGeneration by Graph Search
読み取り中…
検索中…
一致する文字列を見つけられません
loop_util_test.h
[詳解]
1
3
4// Copyright(c) 2023-2025 Design Engineering Laboratory, Saitama University
5// Released under the MIT license
6// https://opensource.org/licenses/mit-license.php
7
8#ifndef DESIGNLAB_LOOP_UTIL_TEST_H_
9#define DESIGNLAB_LOOP_UTIL_TEST_H_
10
11#include <doctest.h>
12
13#include <vector>
14
15#include "loop_util.h"
16
17TEST_SUITE("DoubleIntRange") {
18 using designlab::DoubleIntRange;
19
20 TEST_CASE("When pram is [3,3]") {
21 std::vector<std::tuple<int, int>> expected = {
22 {0, 0}, {0, 1}, {0, 2}, {1, 0}, {1, 1}, {1, 2}, {2, 0}, {2, 1}, {2, 2},
23 };
24
25 std::vector<std::tuple<int, int>> actual;
26
27 for (const auto [i, j] : DoubleIntRange{3, 3}) {
28 actual.push_back(std::make_tuple(i, j));
29 }
30
31 CHECK_EQ(expected, actual);
32 }
33
34 TEST_CASE("When pram is [2,3]") {
35 std::vector<std::tuple<int, int>> expected = {
36 {0, 0}, {0, 1}, {0, 2}, {1, 0}, {1, 1}, {1, 2},
37 };
38
39 std::vector<std::tuple<int, int>> actual;
40
41 for (const auto [i, j] : DoubleIntRange{2, 3}) {
42 actual.push_back(std::make_tuple(i, j));
43 }
44
45 CHECK_EQ(expected, actual);
46 }
47
48 TEST_CASE("When pram is [3,2]") {
49 std::vector<std::tuple<int, int>> expected = {
50 {0, 0}, {0, 1}, {1, 0}, {1, 1}, {2, 0}, {2, 1},
51 };
52
53 std::vector<std::tuple<int, int>> actual;
54
55 for (const auto [i, j] : DoubleIntRange{3, 2}) {
56 actual.push_back(std::make_tuple(i, j));
57 }
58
59 CHECK_EQ(expected, actual);
60 }
61}
62
63#endif // DESIGNLAB_LOOP_UTIL_TEST_H_
TEST_SUITE("DoubleIntRange")