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{
19 using designlab::DoubleIntRange;
20
21 TEST_CASE("When pram is [3,3]")
22 {
23 std::vector<std::tuple<int, int>> expected = {
24 {0, 0}, {0, 1}, {0, 2}, {1, 0}, {1, 1}, {1, 2}, {2, 0}, {2, 1}, {2, 2},
25 };
26
27 std::vector<std::tuple<int, int>> actual;
28
29 for (const auto [i, j] : DoubleIntRange{ 3, 3 })
30 {
31 actual.push_back(std::make_tuple(i, j));
32 }
33
34 CHECK_EQ(expected, actual);
35 }
36
37 TEST_CASE("When pram is [2,3]")
38 {
39 std::vector<std::tuple<int, int>> expected = {
40 {0, 0}, {0, 1}, {0, 2}, {1, 0}, {1, 1}, {1, 2},
41 };
42
43 std::vector<std::tuple<int, int>> actual;
44
45 for (const auto [i, j] : DoubleIntRange{ 2, 3 })
46 {
47 actual.push_back(std::make_tuple(i, j));
48 }
49
50 CHECK_EQ(expected, actual);
51 }
52
53 TEST_CASE("When pram is [3,2]")
54 {
55 std::vector<std::tuple<int, int>> expected = {
56 {0, 0}, {0, 1}, {1, 0}, {1, 1}, {2, 0}, {2, 1},
57 };
58
59 std::vector<std::tuple<int, int>> actual;
60
61 for (const auto [i, j] : DoubleIntRange{ 3, 2 })
62 {
63 actual.push_back(std::make_tuple(i, j));
64 }
65
66 CHECK_EQ(expected, actual);
67 }
68}
69
70#endif // DESIGNLAB_LOOP_UTIL_TEST_H_
TEST_SUITE("DoubleIntRange")