58 lines
2.9 KiB
C++
58 lines
2.9 KiB
C++
#include <Void/Testing/Assert.hpp>
|
|
#include <Void/Testing/Test.hpp>
|
|
#include <vbs/build.hpp>
|
|
|
|
#include <algorithm>
|
|
|
|
Void::Testing::Test example_uses_runtime_compiler() {
|
|
vbs::Profiles definitions;
|
|
profiles(definitions);
|
|
vbs::Project gcc{definitions.resolve("debug", vbs::CompilerFamily::gcc, "linux", "x86_64")};
|
|
vbs::Project clang{definitions.resolve("debug", vbs::CompilerFamily::clang, "linux", "x86_64")};
|
|
build(gcc);
|
|
build(clang);
|
|
for (std::size_t index = 0; index < gcc.targets().size(); ++index) {
|
|
Void::Testing::expect(std::ranges::contains(gcc.targets().at(index).compile_options,
|
|
std::string{"-Wduplicated-cond"}));
|
|
Void::Testing::expect(!std::ranges::contains(gcc.targets().at(index).compile_options,
|
|
std::string{"-Wextra-semi"}));
|
|
Void::Testing::expect(std::ranges::contains(clang.targets().at(index).compile_options,
|
|
std::string{"-Wextra-semi"}));
|
|
Void::Testing::expect(!std::ranges::contains(clang.targets().at(index).compile_options,
|
|
std::string{"-Wduplicated-cond"}));
|
|
}
|
|
}
|
|
|
|
Void::Testing::Test example_profile_options_are_separate() {
|
|
vbs::Profiles definitions;
|
|
profiles(definitions);
|
|
vbs::Project debug{definitions.resolve("debug", vbs::CompilerFamily::gcc, "linux", "x86_64")};
|
|
vbs::Project release{
|
|
definitions.resolve("release", vbs::CompilerFamily::gcc, "linux", "x86_64")};
|
|
build(debug);
|
|
build(release);
|
|
Void::Testing::expect(
|
|
std::ranges::contains(debug.context().compile_options, std::string{"-g"}));
|
|
Void::Testing::expect(
|
|
std::ranges::contains(release.context().compile_options, std::string{"-O3"}));
|
|
Void::Testing::expect(
|
|
!std::ranges::contains(release.context().compile_options, std::string{"-g"}));
|
|
Void::Testing::expect(debug.to_json() != release.to_json());
|
|
}
|
|
|
|
Void::Testing::Test example_records_sources_links_and_pin() {
|
|
vbs::Project project{
|
|
vbs::default_profiles().resolve("debug", vbs::CompilerFamily::gcc, "linux", "x86_64")};
|
|
build(project);
|
|
Void::Testing::expect_eq(project.targets().size(), std::size_t{2});
|
|
Void::Testing::expect_eq(project.targets().at(0).name, std::string{"vbs_sdk"});
|
|
Void::Testing::expect_eq(project.targets().at(0).sources.at(0).path,
|
|
std::string{"src/build.cpp"});
|
|
Void::Testing::expect_eq(project.targets().at(1).links.at(0).target, std::string{"vbs_sdk"});
|
|
Void::Testing::expect_eq(project.targets().at(1).links.at(1).target,
|
|
std::string{"Void::Configuration"});
|
|
Void::Testing::expect_eq(project.dependencies().at(0).revision,
|
|
std::string{"9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5"});
|
|
Void::Testing::expect_eq(project.dependencies().at(0).builder, std::string{"cmake"});
|
|
}
|