Commit d94d504e authored by Linshizhi's avatar Linshizhi

Add googletest.

parent 52e774d1
workspace(name = "IMGRender")
# Google test for unittest purposes
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
git_repository(
name = "gtest",
remote = "https://github.com/google/googletest",
branch = "v1.10.x",
)
# Theft for property-based testing
new_local_repository(
name = "theft",
path = "./external/theft",
build_file = "BUILDS/BUILD.theft"
)
# Needed for each target whose artifacts are to be checked.
cc_test(
name = "check",
srcs = ["check.cc"],
args = ["/home"],
deps = ["//src:render", "@theft//:theft",]
deps = [
"//src:render",
"@theft//:theft",
"@gtest//:gtest",
"@gtest//:gtest_main"
]
)
#include "src/canvas.h"
#include "gtest/gtest.h"
extern "C" {
#include "external/theft/inc/theft.h"
}
int main(void) {
theft_seed_of_time();
return say();
// Tests factorial of 0.
TEST(FactorialTest, HandlesZeroInput) {
EXPECT_EQ(1, 1);
}
// Tests factorial of positive numbers.
TEST(FactorialTest, HandlesPositiveInput) {
EXPECT_EQ(1, 1);
EXPECT_EQ(2, 2);
EXPECT_EQ(6, 6);
EXPECT_EQ(40320, 40320);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment