Add a constants json validator test
Signed-off-by: Maxwell Henderson <mxwhenderson@gmail.com>
Change-Id: I8cf210b8a4d6962a8a65bdcc56f0c29896f4c2ea
diff --git a/y2024/constants/7971.json b/y2024/constants/7971.json
index 94fc375..0062fa8 100644
--- a/y2024/constants/7971.json
+++ b/y2024/constants/7971.json
@@ -1,5 +1,5 @@
{
- "cameras": [
- ],
+ "robot": {
+ },
{% include 'y2024/constants/common.json' %}
}
diff --git a/y2024/constants/971.json b/y2024/constants/971.json
index 2e6ffa8..0062fa8 100644
--- a/y2024/constants/971.json
+++ b/y2024/constants/971.json
@@ -1,8 +1,5 @@
{
- "cameras": [
- ],
"robot": {
- }
},
{% include 'y2024/constants/common.json' %}
}
diff --git a/y2024/constants/9971.json b/y2024/constants/9971.json
index 2e6ffa8..0062fa8 100644
--- a/y2024/constants/9971.json
+++ b/y2024/constants/9971.json
@@ -1,8 +1,5 @@
{
- "cameras": [
- ],
"robot": {
- }
},
{% include 'y2024/constants/common.json' %}
}
diff --git a/y2024/constants/BUILD b/y2024/constants/BUILD
index 1e8faa4..73e92f0 100644
--- a/y2024/constants/BUILD
+++ b/y2024/constants/BUILD
@@ -76,3 +76,16 @@
"//frc971/constants:constants_sender_lib",
],
)
+
+cc_test(
+ name = "constants_validator_test",
+ srcs = ["constants_validator_test.cc"],
+ data = [":constants.json"],
+ visibility = ["//visibility:public"],
+ deps = [
+ ":constants_list_fbs",
+ "//aos:json_to_flatbuffer",
+ "//aos/testing:googletest",
+ "@com_github_google_glog//:glog",
+ ],
+)
diff --git a/y2024/constants/common.json b/y2024/constants/common.json
index 15894ad..1655127 100644
--- a/y2024/constants/common.json
+++ b/y2024/constants/common.json
@@ -1,5 +1 @@
- "target_map": {% include 'y2024/constants/target_map.json' %},
- "ignore_targets": {
- "red": [4],
- "blue": [5]
- }
+ "target_map": {% include 'y2024/constants/target_map.json' %}
diff --git a/y2024/constants/constants_validator_test.cc b/y2024/constants/constants_validator_test.cc
new file mode 100644
index 0000000..238bfc3
--- /dev/null
+++ b/y2024/constants/constants_validator_test.cc
@@ -0,0 +1,21 @@
+#include "glog/logging.h"
+#include "gtest/gtest.h"
+
+#include "aos/json_to_flatbuffer.h"
+#include "y2024/constants/constants_list_generated.h"
+
+namespace y2024 {
+namespace constants {
+namespace testing {
+class ConstantsValidatorTest : public ::testing::Test {};
+
+TEST_F(ConstantsValidatorTest, CheckConstants) {
+ CHECK_NOTNULL(aos::JsonFileToFlatbuffer<y2024::ConstantsList>(
+ "y2024/constants/constants.json")
+ .message()
+ .constants());
+}
+
+} // namespace testing
+} // namespace constants
+} // namespace y2024