Move stuff to Catch2 testing, deprecate current tests

This commit is contained in:
Curle 2022-06-23 22:31:05 +01:00
parent 4dbf5cacea
commit 606709ae3a
10 changed files with 18 additions and 49 deletions

View File

@ -20,12 +20,12 @@ cc_test(
name = "test", name = "test",
srcs = glob(["test/**/*.cpp", "test/**/*.h"]), srcs = glob(["test/**/*.cpp", "test/**/*.h"]),
includes = [], includes = [],
defines = [ "CATCH_CONFIG_MAIN" ],
copts = [ copts = [
"/std:c++17" "/std:c++17"
], ],
deps = [ deps = [
"//projs/shadow-file-format", "//projs/shadow-file-format",
"@gtest//:gtest", "@catch2"
"@gtest//:gtest_main" ],
],
) )

View File

@ -0,0 +1,5 @@
#include <catch2/catch.hpp>
TEST_CASE("15 is less than 20", "[numbers]") {
REQUIRE(15 < 20);
}

View File

@ -1,5 +0,0 @@
//
// pch.cpp
//
#include "pch.h"

View File

@ -1,10 +0,0 @@
//
// pch.h
//
#pragma once
#include "gtest/gtest.h"
#include <string>
#include <sstream>

View File

@ -1,4 +1,3 @@
#include "pch.h"
//import Shadow.FileFormat; //import Shadow.FileFormat;
#include "SFFWriter.h" #include "SFFWriter.h"

View File

@ -1,4 +1,3 @@
#include "gtest/gtest.h"
#include <string> #include <string>
#include <sstream> #include <sstream>

13
vendor/deps.bzl vendored
View File

@ -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/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") load("//vendor/glm:glm-dep.bzl", "glm_dep")
def deps(): def deps():
sdl2_dep() sdl2_dep()
gtest_dep()
# imgui_lib()
glm_dep() 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"],
)

0
vendor/gtest/BUILD vendored
View File

View File

@ -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",
)

View File

@ -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"],
)