Skip to content

Commit

Permalink
add parallel test
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Apr 8, 2024
1 parent 61141e7 commit f64943b
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/projects/other/parallel_build/1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
int main(){
}
31 changes: 31 additions & 0 deletions tests/projects/other/parallel_build/2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Make this object complex and cost longer compile time...
#include <algorithm>
#include <any>
#include <bitset>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <optional>
#include <queue>
#include <string>
#include <unordered_map>
#include <variant>
#include <vector>

int main() {

using Type = std::variant<int8_t, uint8_t, int16_t, uint16_t, int32_t,
uint32_t, int64_t, uint64_t, double, float>;
Type a, b, c;
a = 5;
b = 3.0;
c = 4.0f;
double r;
std::visit([&](auto a, auto b, auto c) { r = a + b + c; }, a, b, c);
std::visit([&](auto a, auto b, auto c) { r = a + b - c; }, a, b, c);
std::visit([&](auto a, auto b, auto c) { r = a - b - c; }, a, b, c);
std::visit([&](auto a, auto b, auto c) { r = (a + b + c) * 2; }, a, b, c);
std::visit([&](auto a, auto b, auto c) { r = (a + b - c) * 3; }, a, b, c);
}
13 changes: 13 additions & 0 deletions tests/projects/other/parallel_build/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- These targets should compiled and linked concurrently.
add_rules("mode.release", "mode.debug", "mode.releasedbg")
set_policy("build.ccache", false)

target("first")
set_kind("binary")
add_files("1.cpp")
set_languages("clatest", "cxx20")

target("second")
set_kind("binary")
add_files("2.cpp")
set_languages("clatest", "cxx20")

0 comments on commit f64943b

Please sign in to comment.