|
| 1 | +#if defined(__GNUC__) && !defined(__clang__) |
| 2 | +#pragma GCC diagnostic push |
| 3 | +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" |
| 4 | +#endif |
| 5 | + |
1 | 6 | #include "CesiumGltf/PropertyTablePropertyView.h"
|
2 | 7 |
|
3 | 8 | #include <catch2/catch.hpp>
|
@@ -58,10 +63,10 @@ template <typename T>
|
58 | 63 | static void checkNumeric(
|
59 | 64 | const std::vector<T>& values,
|
60 | 65 | const std::vector<std::optional<T>>& expected,
|
61 |
| - const std::optional<JsonValue> offset = std::nullopt, |
62 |
| - const std::optional<JsonValue> scale = std::nullopt, |
63 |
| - const std::optional<JsonValue> noData = std::nullopt, |
64 |
| - const std::optional<JsonValue> defaultValue = std::nullopt) { |
| 66 | + const std::optional<JsonValue>& offset = std::nullopt, |
| 67 | + const std::optional<JsonValue>& scale = std::nullopt, |
| 68 | + const std::optional<JsonValue>& noData = std::nullopt, |
| 69 | + const std::optional<JsonValue>& defaultValue = std::nullopt) { |
65 | 70 | std::vector<std::byte> data;
|
66 | 71 | data.resize(values.size() * sizeof(T));
|
67 | 72 | std::memcpy(data.data(), values.data(), data.size());
|
@@ -103,10 +108,10 @@ template <typename T, typename D = typename TypeToNormalizedType<T>::type>
|
103 | 108 | static void checkNormalizedNumeric(
|
104 | 109 | const std::vector<T>& values,
|
105 | 110 | const std::vector<std::optional<D>>& expected,
|
106 |
| - const std::optional<JsonValue> offset = std::nullopt, |
107 |
| - const std::optional<JsonValue> scale = std::nullopt, |
108 |
| - const std::optional<JsonValue> noData = std::nullopt, |
109 |
| - const std::optional<JsonValue> defaultValue = std::nullopt) { |
| 111 | + const std::optional<JsonValue>& offset = std::nullopt, |
| 112 | + const std::optional<JsonValue>& scale = std::nullopt, |
| 113 | + const std::optional<JsonValue>& noData = std::nullopt, |
| 114 | + const std::optional<JsonValue>& defaultValue = std::nullopt) { |
110 | 115 | std::vector<std::byte> data;
|
111 | 116 | data.resize(values.size() * sizeof(T));
|
112 | 117 | std::memcpy(data.data(), values.data(), data.size());
|
@@ -211,8 +216,8 @@ static void checkVariableLengthArray(
|
211 | 216 | PropertyComponentType offsetType,
|
212 | 217 | int64_t instanceCount,
|
213 | 218 | const std::vector<std::optional<std::vector<DataType>>>& expected,
|
214 |
| - const std::optional<JsonValue::Array> noData = std::nullopt, |
215 |
| - const std::optional<JsonValue::Array> defaultValue = std::nullopt) { |
| 219 | + const std::optional<JsonValue::Array>& noData = std::nullopt, |
| 220 | + const std::optional<JsonValue::Array>& defaultValue = std::nullopt) { |
216 | 221 | // copy data to buffer
|
217 | 222 | std::vector<std::byte> buffer;
|
218 | 223 | buffer.resize(data.size() * sizeof(DataType));
|
@@ -292,8 +297,8 @@ static void checkNormalizedVariableLengthArray(
|
292 | 297 | PropertyComponentType offsetType,
|
293 | 298 | int64_t instanceCount,
|
294 | 299 | const std::vector<std::optional<std::vector<NormalizedType>>>& expected,
|
295 |
| - const std::optional<JsonValue::Array> noData = std::nullopt, |
296 |
| - const std::optional<JsonValue::Array> defaultValue = std::nullopt) { |
| 300 | + const std::optional<JsonValue::Array>& noData = std::nullopt, |
| 301 | + const std::optional<JsonValue::Array>& defaultValue = std::nullopt) { |
297 | 302 | // copy data to buffer
|
298 | 303 | std::vector<std::byte> buffer;
|
299 | 304 | buffer.resize(data.size() * sizeof(DataType));
|
@@ -421,10 +426,10 @@ static void checkFixedLengthArray(
|
421 | 426 | const std::vector<T>& data,
|
422 | 427 | int64_t fixedLengthArrayCount,
|
423 | 428 | const std::vector<std::optional<std::vector<T>>>& expected,
|
424 |
| - const std::optional<JsonValue::Array> offset = std::nullopt, |
425 |
| - const std::optional<JsonValue::Array> scale = std::nullopt, |
426 |
| - const std::optional<JsonValue::Array> noData = std::nullopt, |
427 |
| - const std::optional<JsonValue::Array> defaultValue = std::nullopt) { |
| 429 | + const std::optional<JsonValue::Array>& offset = std::nullopt, |
| 430 | + const std::optional<JsonValue::Array>& scale = std::nullopt, |
| 431 | + const std::optional<JsonValue::Array>& noData = std::nullopt, |
| 432 | + const std::optional<JsonValue::Array>& defaultValue = std::nullopt) { |
428 | 433 | int64_t instanceCount =
|
429 | 434 | static_cast<int64_t>(data.size()) / fixedLengthArrayCount;
|
430 | 435 |
|
@@ -496,10 +501,10 @@ static void checkNormalizedFixedLengthArray(
|
496 | 501 | const std::vector<T>& data,
|
497 | 502 | int64_t fixedLengthArrayCount,
|
498 | 503 | const std::vector<std::optional<std::vector<D>>>& expected,
|
499 |
| - const std::optional<JsonValue::Array> offset = std::nullopt, |
500 |
| - const std::optional<JsonValue::Array> scale = std::nullopt, |
501 |
| - const std::optional<JsonValue::Array> noData = std::nullopt, |
502 |
| - const std::optional<JsonValue::Array> defaultValue = std::nullopt) { |
| 504 | + const std::optional<JsonValue::Array>& offset = std::nullopt, |
| 505 | + const std::optional<JsonValue::Array>& scale = std::nullopt, |
| 506 | + const std::optional<JsonValue::Array>& noData = std::nullopt, |
| 507 | + const std::optional<JsonValue::Array>& defaultValue = std::nullopt) { |
503 | 508 | int64_t instanceCount =
|
504 | 509 | static_cast<int64_t>(data.size()) / fixedLengthArrayCount;
|
505 | 510 |
|
@@ -3711,3 +3716,7 @@ TEST_CASE("Check variable-length boolean array PropertyTablePropertyView") {
|
3711 | 3716 | }
|
3712 | 3717 | }
|
3713 | 3718 | }
|
| 3719 | + |
| 3720 | +#if defined(__GNUC__) && !defined(__clang__) |
| 3721 | +#pragma GCC diagnostic pop |
| 3722 | +#endif |
0 commit comments