From 606709ae3a51f8ec585af4d0ea2c74af355b9910 Mon Sep 17 00:00:00 2001 From: Curle Date: Thu, 23 Jun 2022 22:31:05 +0100 Subject: [PATCH] Move stuff to Catch2 testing, deprecate current tests --- projs/shadow-file-format/BUILD | 6 +++--- projs/shadow-file-format/test/Catch2Test.cpp | 5 +++++ projs/shadow-file-format/test/pch.cpp | 5 ----- projs/shadow-file-format/test/pch.h | 10 ---------- ...sff_writer_tests.cpp => sff_writer_tests.ocpp} | 1 - .../test/{test.cpp => test.ocpp} | 1 - vendor/deps.bzl | 15 ++++++++++----- vendor/gtest/BUILD | 0 vendor/gtest/gtest-dep.bzl | 10 ---------- vendor/gtest/gtest.BUILD | 14 -------------- 10 files changed, 18 insertions(+), 49 deletions(-) create mode 100644 projs/shadow-file-format/test/Catch2Test.cpp delete mode 100644 projs/shadow-file-format/test/pch.cpp delete mode 100644 projs/shadow-file-format/test/pch.h rename projs/shadow-file-format/test/{sff_writer_tests.cpp => sff_writer_tests.ocpp} (94%) rename projs/shadow-file-format/test/{test.cpp => test.ocpp} (99%) delete mode 100644 vendor/gtest/BUILD delete mode 100644 vendor/gtest/gtest-dep.bzl delete mode 100644 vendor/gtest/gtest.BUILD diff --git a/projs/shadow-file-format/BUILD b/projs/shadow-file-format/BUILD index d5185cf..2ffe3ac 100644 --- a/projs/shadow-file-format/BUILD +++ b/projs/shadow-file-format/BUILD @@ -20,12 +20,12 @@ cc_test( name = "test", srcs = glob(["test/**/*.cpp", "test/**/*.h"]), includes = [], + defines = [ "CATCH_CONFIG_MAIN" ], copts = [ "/std:c++17" ], deps = [ "//projs/shadow-file-format", - "@gtest//:gtest", - "@gtest//:gtest_main" - ], + "@catch2" + ], ) \ No newline at end of file diff --git a/projs/shadow-file-format/test/Catch2Test.cpp b/projs/shadow-file-format/test/Catch2Test.cpp new file mode 100644 index 0000000..07ed832 --- /dev/null +++ b/projs/shadow-file-format/test/Catch2Test.cpp @@ -0,0 +1,5 @@ +#include + +TEST_CASE("15 is less than 20", "[numbers]") { + REQUIRE(15 < 20); +} \ No newline at end of file diff --git a/projs/shadow-file-format/test/pch.cpp b/projs/shadow-file-format/test/pch.cpp deleted file mode 100644 index 250fb27..0000000 --- a/projs/shadow-file-format/test/pch.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// -// pch.cpp -// - -#include "pch.h" diff --git a/projs/shadow-file-format/test/pch.h b/projs/shadow-file-format/test/pch.h deleted file mode 100644 index 6a19cdc..0000000 --- a/projs/shadow-file-format/test/pch.h +++ /dev/null @@ -1,10 +0,0 @@ -// -// pch.h -// - -#pragma once - -#include "gtest/gtest.h" - -#include -#include \ No newline at end of file diff --git a/projs/shadow-file-format/test/sff_writer_tests.cpp b/projs/shadow-file-format/test/sff_writer_tests.ocpp similarity index 94% rename from projs/shadow-file-format/test/sff_writer_tests.cpp rename to projs/shadow-file-format/test/sff_writer_tests.ocpp index 6e2cc9c..3a9e671 100644 --- a/projs/shadow-file-format/test/sff_writer_tests.cpp +++ b/projs/shadow-file-format/test/sff_writer_tests.ocpp @@ -1,4 +1,3 @@ -#include "pch.h" //import Shadow.FileFormat; #include "SFFWriter.h" diff --git a/projs/shadow-file-format/test/test.cpp b/projs/shadow-file-format/test/test.ocpp similarity index 99% rename from projs/shadow-file-format/test/test.cpp rename to projs/shadow-file-format/test/test.ocpp index 67e7b0c..e404063 100644 --- a/projs/shadow-file-format/test/test.cpp +++ b/projs/shadow-file-format/test/test.ocpp @@ -1,4 +1,3 @@ -#include "gtest/gtest.h" #include #include diff --git a/vendor/deps.bzl b/vendor/deps.bzl index 1dcea32..25dee82 100644 --- a/vendor/deps.bzl +++ b/vendor/deps.bzl @@ -1,10 +1,15 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("//vendor/sdl2:sdl2-dep.bzl", "sdl2_dep") -load("//vendor/gtest:gtest-dep.bzl", "gtest_dep") -#load("//vendor/imgui:imgui_lib.bzl", "imgui_lib") load("//vendor/glm:glm-dep.bzl", "glm_dep") + def deps(): sdl2_dep() - gtest_dep() -# imgui_lib() - glm_dep() \ No newline at end of file + glm_dep() + + # this doesn't require a whole folder with a build, props, bzl file, so it's set here. + http_archive( + name = "catch2", + strip_prefix = "Catch2-2.13.0", + urls = ["https://github.com/catchorg/Catch2/archive/v2.13.0.tar.gz"], + ) \ No newline at end of file diff --git a/vendor/gtest/BUILD b/vendor/gtest/BUILD deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/gtest/gtest-dep.bzl b/vendor/gtest/gtest-dep.bzl deleted file mode 100644 index 2b7fc3a..0000000 --- a/vendor/gtest/gtest-dep.bzl +++ /dev/null @@ -1,10 +0,0 @@ -load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") - - -def gtest_dep(): - if "gtest" not in native.existing_rules(): - git_repository( - name = "gtest", - remote = "https://github.com/google/googletest", - branch = "v1.10.x", - ) \ No newline at end of file diff --git a/vendor/gtest/gtest.BUILD b/vendor/gtest/gtest.BUILD deleted file mode 100644 index ca475f7..0000000 --- a/vendor/gtest/gtest.BUILD +++ /dev/null @@ -1,14 +0,0 @@ -cc_library( - name = "gtest_main", - srcs = glob( - ["src/*.cc"], - exclude = ["src/gtest-all.cc"] - ), - hdrs = glob([ - "include/**/*.h", - "src/*.h" - ]), - copts = ["-Iexternal/gtest/include"], - linkopts = ["-pthread"], - visibility = ["//visibility:public"], -) \ No newline at end of file