Merge pull request #3 from TheCurle/bazel-setup

Move stuff to Catch2 testing, deprecate current tests
This commit is contained in:
dpeter99 2022-06-24 12:08:15 +02:00 committed by GitHub
commit e1f14553fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 19 additions and 50 deletions

View File

@ -56,7 +56,7 @@ jobs:
key: ${{ runner.os }}-${{ github.run_id }}
- name: Test shadow-file-format
run: ./bazel-bin/projs/shadow-file-format/test.exe --gtest_output="xml:./test-results/shadow-file-format-test.xml"
run: ./bazel-bin/projs/shadow-file-format/test.exe -r junit -o ./test-results/shadow-file-format-test.xml
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v1

View File

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

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;
#include "SFFWriter.h"

View File

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

15
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/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()
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"],
)