diff options
Diffstat (limited to 'tests/test_cases')
43 files changed, 614 insertions, 0 deletions
diff --git a/tests/test_cases/cflags/TARGETS b/tests/test_cases/cflags/TARGETS new file mode 100644 index 0000000..44c99f1 --- /dev/null +++ b/tests/test_cases/cflags/TARGETS @@ -0,0 +1,19 @@ +{ "public": + { "type": ["test_rules", "test_case"] + , "name": ["cflags_public"] + , "targets": + [ "+main_use_half3" + , "+test_use_half3" + , "+main_use_half3f" + , "+test_use_half3f" + ] + , "asserts": + [ "./main_use_half3/main_use_half3 | grep 1.5" + , "[ \"$(cat ./test_use_half3/result)\" = \"PASS\" ]" + , "./main_use_half3f/main_use_half3f | grep 1.5" + , "[ \"$(cat ./test_use_half3f/result)\" = \"PASS\" ]" + ] + , "data": [["TREE", null, "public"]] + } +, "ALL": {"type": "install", "deps": ["public"], "tainted": ["test"]} +} diff --git a/tests/test_cases/cflags/public/TARGETS b/tests/test_cases/cflags/public/TARGETS new file mode 100644 index 0000000..79aadb3 --- /dev/null +++ b/tests/test_cases/cflags/public/TARGETS @@ -0,0 +1,49 @@ +{ "half": + { "type": ["@", "rules", "CC", "library"] + , "name": ["half"] + , "hdrs": ["half.hpp"] + , "srcs": ["half.cpp"] + , "cflags": ["-DHALF_PRECISION_DOUBLE"] + , "stage": ["half"] + } +, "half3": + { "type": ["@", "rules", "CC", "library"] + , "name": ["half3"] + , "hdrs": ["half3.hpp"] + , "srcs": ["half3.cpp"] + , "deps": ["half"] + , "stage": ["half3"] + } +, "half3f": + { "type": ["@", "rules", "CC", "library"] + , "name": ["half3f"] + , "hdrs": ["half3f.hpp"] + , "srcs": ["half3f.cpp"] + , "private-deps": ["half3"] + , "stage": ["half3f"] + } +, "main_use_half3": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["main_use_half3"] + , "srcs": ["main_use_half3.cpp"] + , "private-deps": ["half3"] + } +, "test_use_half3": + { "type": ["@", "rules", "CC/test", "test"] + , "name": ["test_use_half3"] + , "srcs": ["test_use_half3.cpp"] + , "private-deps": ["half3"] + } +, "main_use_half3f": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["main_use_half3f"] + , "srcs": ["main_use_half3f.cpp"] + , "private-deps": ["half3f"] + } +, "test_use_half3f": + { "type": ["@", "rules", "CC/test", "test"] + , "name": ["test_use_half3f"] + , "srcs": ["test_use_half3f.cpp"] + , "private-deps": ["half3f"] + } +} diff --git a/tests/test_cases/cflags/public/half.cpp b/tests/test_cases/cflags/public/half.cpp new file mode 100644 index 0000000..e26ff6e --- /dev/null +++ b/tests/test_cases/cflags/public/half.cpp @@ -0,0 +1,5 @@ +#include "half.hpp" + +HALF_RESULT_TYPE half(int val) { + return static_cast<HALF_RESULT_TYPE>(val / 2.0); +} diff --git a/tests/test_cases/cflags/public/half.hpp b/tests/test_cases/cflags/public/half.hpp new file mode 100644 index 0000000..0baebcb --- /dev/null +++ b/tests/test_cases/cflags/public/half.hpp @@ -0,0 +1,12 @@ +#ifndef HALF_HPP +#define HALF_HPP + +#ifdef HALF_PRECISION_DOUBLE +#define HALF_RESULT_TYPE double +#else +#define HALF_RESULT_TYPE int +#endif + +HALF_RESULT_TYPE half(int val); + +#endif diff --git a/tests/test_cases/cflags/public/half3.cpp b/tests/test_cases/cflags/public/half3.cpp new file mode 100644 index 0000000..484f7f8 --- /dev/null +++ b/tests/test_cases/cflags/public/half3.cpp @@ -0,0 +1,3 @@ +#include "half3.hpp" + +HALF_RESULT_TYPE half3() { return half(3); } diff --git a/tests/test_cases/cflags/public/half3.hpp b/tests/test_cases/cflags/public/half3.hpp new file mode 100644 index 0000000..271ed68 --- /dev/null +++ b/tests/test_cases/cflags/public/half3.hpp @@ -0,0 +1,8 @@ +#ifndef HALF3_HPP +#define HALF3_HPP + +#include "half/half.hpp" + +HALF_RESULT_TYPE half3(); + +#endif diff --git a/tests/test_cases/cflags/public/half3f.cpp b/tests/test_cases/cflags/public/half3f.cpp new file mode 100644 index 0000000..88b6d55 --- /dev/null +++ b/tests/test_cases/cflags/public/half3f.cpp @@ -0,0 +1,7 @@ +#include "half3/half3.hpp" + +#ifndef HALF_PRECISION_DOUBLE +#error should be defined +#endif + +float half3f() { return static_cast<float>(half3()); } diff --git a/tests/test_cases/cflags/public/half3f.hpp b/tests/test_cases/cflags/public/half3f.hpp new file mode 100644 index 0000000..1207f63 --- /dev/null +++ b/tests/test_cases/cflags/public/half3f.hpp @@ -0,0 +1,6 @@ +#ifndef BAZ_HPP +#define BAZ_HPP + +float half3f(); + +#endif diff --git a/tests/test_cases/cflags/public/main_use_half3.cpp b/tests/test_cases/cflags/public/main_use_half3.cpp new file mode 100644 index 0000000..1c9d6ba --- /dev/null +++ b/tests/test_cases/cflags/public/main_use_half3.cpp @@ -0,0 +1,7 @@ +#include "half3/half3.hpp" +#include <iostream> + +int main() { + std::cout << half3() << std::endl; + return 0; +} diff --git a/tests/test_cases/cflags/public/main_use_half3f.cpp b/tests/test_cases/cflags/public/main_use_half3f.cpp new file mode 100644 index 0000000..3e855cd --- /dev/null +++ b/tests/test_cases/cflags/public/main_use_half3f.cpp @@ -0,0 +1,11 @@ +#include "half3f/half3f.hpp" +#include <iostream> + +#ifdef HALF_PRECISION_DOUBLE +#error should not be defined +#endif + +int main() { + std::cout << half3f() << std::endl; + return 0; +} diff --git a/tests/test_cases/cflags/public/test_use_half3.cpp b/tests/test_cases/cflags/public/test_use_half3.cpp new file mode 100644 index 0000000..1cf50ad --- /dev/null +++ b/tests/test_cases/cflags/public/test_use_half3.cpp @@ -0,0 +1,6 @@ +#include "half3/half3.hpp" + +int main() { + auto result = half3(); + return result > 1 and result < 2 ? 0 : 1; +} diff --git a/tests/test_cases/cflags/public/test_use_half3f.cpp b/tests/test_cases/cflags/public/test_use_half3f.cpp new file mode 100644 index 0000000..078e69c --- /dev/null +++ b/tests/test_cases/cflags/public/test_use_half3f.cpp @@ -0,0 +1,10 @@ +#include "half3f/half3f.hpp" + +#ifdef HALF_PRECISION_DOUBLE +#error should not be defined +#endif + +int main() { + auto result = half3f(); + return result > 1 and result < 2 ? 0 : 1; +} diff --git a/tests/test_cases/deps/TARGETS b/tests/test_cases/deps/TARGETS new file mode 100644 index 0000000..fa6ef0b --- /dev/null +++ b/tests/test_cases/deps/TARGETS @@ -0,0 +1,104 @@ +{ "private": + { "type": ["test_rules", "test_case"] + , "name": ["deps_private"] + , "targets": + [ "+foo" + , "-main_includes_foo" + , "+main_links_foo" + , "+main_links_bar_foo" + , "+install_bar" + ] + , "asserts": + [ "test -f foo/foo/libfoo.a" + , "test -f foo/foo/foo.hpp" + , "! test -f foo/bar/bar.hpp" + , "./main_links_foo/main | grep foo" + , "./main_links_bar_foo/main | grep bar" + , "./main_links_bar_foo/main | grep foo" + , "test -f install_bar/lib/bar/libbar.a" + , "test -f install_bar/include/bar/bar.hpp" + , "test -f install_bar/lib/foo/libfoo.a" + , "! test -f install_bar/include/foo/foo.hpp" + ] + , "data": [["TREE", null, "private"]] + } +, "public": + { "type": ["test_rules", "test_case"] + , "name": ["deps_public"] + , "targets": + [ "+foo" + , "+main_includes_foo" + , "+main_links_foo" + , "+main_links_bar_foo" + , "+install_bar" + ] + , "asserts": + [ "test -f foo/foo/libfoo.a" + , "test -f foo/foo/foo.hpp" + , "! test -f foo/bar/bar.hpp" + , "./main_includes_foo/main | grep main" + , "./main_links_foo/main | grep foo" + , "./main_links_bar_foo/main | grep bar" + , "./main_links_bar_foo/main | grep foo" + , "test -f install_bar/lib/bar/libbar.a" + , "test -f install_bar/include/bar/bar.hpp" + , "test -f install_bar/lib/foo/libfoo.a" + , "test -f install_bar/include/foo/foo.hpp" + ] + , "data": [["TREE", null, "public"]] + } +, "shared": + { "type": ["test_rules", "test_case"] + , "name": ["deps_shared"] + , "targets": + [ "+foo" + , "+bar" + , "+main_uses_foo" + , "+test_uses_foo" + , "+main_uses_bar" + , "+test_uses_bar" + , "+test_uses_bar_s" + , "+test_uses_baz" + , "+test_uses_main" + , "+test_diamond" + , "+install_foo" + , "+install_bar_s" + , "+install_baz" + , "+install_main" + ] + , "asserts": + [ "test -f foo/libfoo.so.1.2.3" + , "test -f foo/foo/foo.hpp" + , "test -f bar/libbar.so" + , "test -f bar/bar/bar.hpp" + , "! test -f bar/foo/foo.hpp" + , "test -f install_foo/lib/libfoo.so.1.2.3" + , "test -f install_foo/include/foo/foo.hpp" + , "grep 'Name: foo' install_foo/share/pkgconfig/foo.pc" + , "grep 'Version: 1.2.3' install_foo/share/pkgconfig/foo.pc" + , "grep -- '-L${libdir}' install_foo/share/pkgconfig/foo.pc" + , "grep -- '-l:libfoo.so.1.2.3' install_foo/share/pkgconfig/foo.pc" + , "test -f install_bar_s/lib/bar/libbar.a" + , "test -f install_bar_s/include/bar/bar.hpp" + , "test -f install_bar_s/lib/libfoo.so.1.2.3" + , "! test -f install_bar_s/include/foo/foo.hpp" + , "grep 'Name: bar' install_bar_s/share/pkgconfig/bar.pc" + , "grep '${libdir}/bar/libbar.a' install_bar_s/share/pkgconfig/bar.pc" + , "grep '${libdir}/libfoo.so.1.2.3' install_bar_s/share/pkgconfig/bar.pc" + , "test -f install_baz/lib/libbaz.so" + , "test -f install_baz/include/baz/baz.hpp" + , "! test -f install_baz/lib/foo/libfoo.a" + , "! test -f install_baz/include/foo/foo.hpp" + , "./install_main/bin/main_uses_bar | grep main" + , "./install_main/bin/main_uses_bar | grep bar" + , "./install_main/bin/main_uses_bar | grep foo" + , "! test -d install_main/include" + ] + , "data": [["TREE", null, "shared"]] + } +, "ALL": + { "type": "install" + , "deps": ["private", "public", "shared"] + , "tainted": ["test"] + } +} diff --git a/tests/test_cases/deps/private/TARGETS b/tests/test_cases/deps/private/TARGETS new file mode 100644 index 0000000..dd72948 --- /dev/null +++ b/tests/test_cases/deps/private/TARGETS @@ -0,0 +1,36 @@ +{ "foo": + { "type": ["@", "rules", "CC", "library"] + , "name": ["foo"] + , "hdrs": ["foo.hpp"] + , "srcs": ["foo.cpp"] + , "stage": ["foo"] + } +, "bar": + { "type": ["@", "rules", "CC", "library"] + , "name": ["bar"] + , "hdrs": ["bar.hpp"] + , "srcs": ["bar.cpp"] + , "private-deps": ["foo"] + , "stage": ["bar"] + } +, "main_includes_foo": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["main"] + , "srcs": ["main_includes_foo.cpp"] + , "private-deps": ["bar"] + } +, "main_links_foo": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["main"] + , "srcs": ["main_links_foo.cpp"] + , "private-deps": ["bar"] + } +, "main_links_bar_foo": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["main"] + , "srcs": ["main_links_bar_foo.cpp"] + , "private-deps": ["bar"] + } +, "install_bar": + {"type": ["@", "rules", "CC", "install-with-deps"], "targets": ["bar"]} +} diff --git a/tests/test_cases/deps/private/bar.cpp b/tests/test_cases/deps/private/bar.cpp new file mode 100644 index 0000000..dfce0e8 --- /dev/null +++ b/tests/test_cases/deps/private/bar.cpp @@ -0,0 +1,8 @@ +#include "foo/foo.hpp" +#include "bar.hpp" +#include <iostream> + +int bar() { + std::cout << "bar\n"; + return foo(); +} diff --git a/tests/test_cases/deps/private/bar.hpp b/tests/test_cases/deps/private/bar.hpp new file mode 100644 index 0000000..94d4f16 --- /dev/null +++ b/tests/test_cases/deps/private/bar.hpp @@ -0,0 +1,6 @@ +#ifndef BAR_HPP +#define BAR_HPP + +int bar(); + +#endif diff --git a/tests/test_cases/deps/private/foo.cpp b/tests/test_cases/deps/private/foo.cpp new file mode 100644 index 0000000..f985022 --- /dev/null +++ b/tests/test_cases/deps/private/foo.cpp @@ -0,0 +1,7 @@ +#include "foo.hpp" +#include <iostream> + +int foo() { + std::cout << "foo\n"; + return 0; +} diff --git a/tests/test_cases/deps/private/foo.hpp b/tests/test_cases/deps/private/foo.hpp new file mode 100644 index 0000000..1a28686 --- /dev/null +++ b/tests/test_cases/deps/private/foo.hpp @@ -0,0 +1,6 @@ +#ifndef FOO_HPP +#define FOO_HPP + +int foo(); + +#endif diff --git a/tests/test_cases/deps/private/main_includes_foo.cpp b/tests/test_cases/deps/private/main_includes_foo.cpp new file mode 100644 index 0000000..16701c7 --- /dev/null +++ b/tests/test_cases/deps/private/main_includes_foo.cpp @@ -0,0 +1,9 @@ +// test that foo.hpp not available + +#include "foo/foo.hpp" +#include <iostream> + +int main() { + std::cout << "main\n"; + return 0; +} diff --git a/tests/test_cases/deps/private/main_links_bar_foo.cpp b/tests/test_cases/deps/private/main_links_bar_foo.cpp new file mode 100644 index 0000000..e936074 --- /dev/null +++ b/tests/test_cases/deps/private/main_links_bar_foo.cpp @@ -0,0 +1,9 @@ +// test that foo is linked after bar + +#include "bar/bar.hpp" +#include <iostream> + +int main() { + std::cout << "main\n"; + return bar(); +} diff --git a/tests/test_cases/deps/private/main_links_foo.cpp b/tests/test_cases/deps/private/main_links_foo.cpp new file mode 100644 index 0000000..1e1e07a --- /dev/null +++ b/tests/test_cases/deps/private/main_links_foo.cpp @@ -0,0 +1,10 @@ +// test that foo is linked + +#include <iostream> + +int foo(); // forward declare + +int main() { + std::cout << "main\n"; + return foo(); +} diff --git a/tests/test_cases/deps/public/TARGETS b/tests/test_cases/deps/public/TARGETS new file mode 100644 index 0000000..bc1807a --- /dev/null +++ b/tests/test_cases/deps/public/TARGETS @@ -0,0 +1,36 @@ +{ "foo": + { "type": ["@", "rules", "CC", "library"] + , "name": ["foo"] + , "hdrs": ["foo.hpp"] + , "srcs": ["foo.cpp"] + , "stage": ["foo"] + } +, "bar": + { "type": ["@", "rules", "CC", "library"] + , "name": ["bar"] + , "hdrs": ["bar.hpp"] + , "srcs": ["bar.cpp"] + , "deps": ["foo"] + , "stage": ["bar"] + } +, "main_includes_foo": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["main"] + , "srcs": ["main_includes_foo.cpp"] + , "private-deps": ["bar"] + } +, "main_links_foo": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["main"] + , "srcs": ["main_links_foo.cpp"] + , "private-deps": ["bar"] + } +, "main_links_bar_foo": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["main"] + , "srcs": ["main_links_bar_foo.cpp"] + , "private-deps": ["bar"] + } +, "install_bar": + {"type": ["@", "rules", "CC", "install-with-deps"], "targets": ["bar"]} +} diff --git a/tests/test_cases/deps/public/bar.cpp b/tests/test_cases/deps/public/bar.cpp new file mode 100644 index 0000000..f2a779a --- /dev/null +++ b/tests/test_cases/deps/public/bar.cpp @@ -0,0 +1,7 @@ +#include "bar.hpp" +#include <iostream> + +int bar(Foo *foo) { + std::cout << "bar\n"; + return (foo == nullptr) ? -1 : foo->foo(); +} diff --git a/tests/test_cases/deps/public/bar.hpp b/tests/test_cases/deps/public/bar.hpp new file mode 100644 index 0000000..ec9c165 --- /dev/null +++ b/tests/test_cases/deps/public/bar.hpp @@ -0,0 +1,8 @@ +#ifndef BAR_HPP +#define BAR_HPP + +#include "foo/foo.hpp" + +int bar(Foo *foo); + +#endif diff --git a/tests/test_cases/deps/public/foo.cpp b/tests/test_cases/deps/public/foo.cpp new file mode 100644 index 0000000..6899c7a --- /dev/null +++ b/tests/test_cases/deps/public/foo.cpp @@ -0,0 +1,7 @@ +#include "foo.hpp" +#include <iostream> + +int Foo::foo() { + std::cout << "foo\n"; + return 0; +} diff --git a/tests/test_cases/deps/public/foo.hpp b/tests/test_cases/deps/public/foo.hpp new file mode 100644 index 0000000..025f3ef --- /dev/null +++ b/tests/test_cases/deps/public/foo.hpp @@ -0,0 +1,8 @@ +#ifndef FOO_HPP +#define FOO_HPP + +struct Foo { + int foo(); +}; + +#endif diff --git a/tests/test_cases/deps/public/main_includes_foo.cpp b/tests/test_cases/deps/public/main_includes_foo.cpp new file mode 100644 index 0000000..e8a85b6 --- /dev/null +++ b/tests/test_cases/deps/public/main_includes_foo.cpp @@ -0,0 +1,9 @@ +// test that foo.hpp is available (despite unused here) + +#include "foo/foo.hpp" +#include <iostream> + +int main() { + std::cout << "main\n"; + return 0; +} diff --git a/tests/test_cases/deps/public/main_links_bar_foo.cpp b/tests/test_cases/deps/public/main_links_bar_foo.cpp new file mode 100644 index 0000000..02c2966 --- /dev/null +++ b/tests/test_cases/deps/public/main_links_bar_foo.cpp @@ -0,0 +1,10 @@ +// test that foo is linked after bar + +#include "bar/bar.hpp" +#include <iostream> + +int main() { + std::cout << "main\n"; + Foo foo{}; + return bar(&foo); +} diff --git a/tests/test_cases/deps/public/main_links_foo.cpp b/tests/test_cases/deps/public/main_links_foo.cpp new file mode 100644 index 0000000..f9cc308 --- /dev/null +++ b/tests/test_cases/deps/public/main_links_foo.cpp @@ -0,0 +1,10 @@ +// test that foo is linked + +#include "foo/foo.hpp" +#include <iostream> + +int main() { + std::cout << "main\n"; + Foo{}.foo(); + return 0; +} diff --git a/tests/test_cases/deps/shared/TARGETS b/tests/test_cases/deps/shared/TARGETS new file mode 100644 index 0000000..9db7fb8 --- /dev/null +++ b/tests/test_cases/deps/shared/TARGETS @@ -0,0 +1,104 @@ +{ "foo": + { "type": ["@", "rules", "CC", "library"] + , "shared": ["yes"] + , "name": ["foo"] + , "soversion": ["1", "2", "3"] + , "hdrs": ["foo.hpp"] + , "srcs": ["foo.cpp"] + , "stage": ["foo"] + } +, "foo_s": + { "type": ["@", "rules", "CC", "library"] + , "name": ["foo"] + , "hdrs": ["foo.hpp"] + , "srcs": ["foo.cpp"] + , "stage": ["foo"] + } +, "bar": + { "type": ["@", "rules", "CC", "library"] + , "shared": ["yes"] + , "name": ["bar"] + , "hdrs": ["bar.hpp"] + , "srcs": ["bar.cpp"] + , "stage": ["bar"] + , "private-deps": ["foo"] + } +, "bar_s": + { "type": ["@", "rules", "CC", "library"] + , "name": ["bar"] + , "hdrs": ["bar.hpp"] + , "srcs": ["bar.cpp"] + , "stage": ["bar"] + , "private-deps": ["foo"] + } +, "baz": + { "type": ["@", "rules", "CC", "library"] + , "name": ["baz"] + , "shared": ["yes"] + , "hdrs": ["baz.hpp"] + , "srcs": ["baz.cpp"] + , "stage": ["baz"] + , "private-deps": ["foo_s"] + } +, "main_uses_foo": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["main_uses_foo"] + , "srcs": ["main_uses_foo.cpp"] + , "private-deps": ["foo"] + } +, "test_uses_foo": + { "type": ["@", "rules", "CC/test", "test"] + , "name": ["test_uses_foo"] + , "srcs": ["test_uses_foo.cpp"] + , "private-deps": ["foo"] + } +, "main_uses_bar": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["main_uses_bar"] + , "srcs": ["main_uses_bar.cpp"] + , "private-deps": ["bar"] + } +, "test_uses_bar": + { "type": ["@", "rules", "CC/test", "test"] + , "name": ["test_uses_bar"] + , "srcs": ["test_uses_bar.cpp"] + , "private-deps": ["bar"] + } +, "test_uses_bar_s": + { "type": ["@", "rules", "CC/test", "test"] + , "name": ["test_uses_bar_s"] + , "srcs": ["test_uses_bar.cpp"] + , "private-deps": ["bar_s"] + } +, "test_uses_baz": + { "type": ["@", "rules", "CC/test", "test"] + , "name": ["test_uses_baz"] + , "srcs": ["test_uses_baz.cpp"] + , "private-deps": ["baz"] + } +, "test_uses_main": + { "type": ["@", "rules", "shell/test", "script"] + , "name": ["test_uses_main"] + , "test": ["test_uses_main.sh"] + , "deps": ["main_uses_bar"] + } +, "test_diamond": + { "type": ["@", "rules", "CC/test", "test"] + , "name": ["test_diamond"] + , "srcs": ["test_diamond.cpp"] + , "private-deps": ["foo_s", "baz"] + } +, "install_foo": + { "type": ["@", "rules", "CC", "install-with-deps"] + , "targets": ["foo"] + , "flat-libs": ["yes"] + } +, "install_bar_s": + {"type": ["@", "rules", "CC", "install-with-deps"], "targets": ["bar_s"]} +, "install_baz": + {"type": ["@", "rules", "CC", "install-with-deps"], "targets": ["baz"]} +, "install_main": + { "type": ["@", "rules", "CC", "install-with-deps"] + , "targets": ["main_uses_bar"] + } +} diff --git a/tests/test_cases/deps/shared/bar.cpp b/tests/test_cases/deps/shared/bar.cpp new file mode 100644 index 0000000..dfce0e8 --- /dev/null +++ b/tests/test_cases/deps/shared/bar.cpp @@ -0,0 +1,8 @@ +#include "foo/foo.hpp" +#include "bar.hpp" +#include <iostream> + +int bar() { + std::cout << "bar\n"; + return foo(); +} diff --git a/tests/test_cases/deps/shared/bar.hpp b/tests/test_cases/deps/shared/bar.hpp new file mode 100644 index 0000000..94d4f16 --- /dev/null +++ b/tests/test_cases/deps/shared/bar.hpp @@ -0,0 +1,6 @@ +#ifndef BAR_HPP +#define BAR_HPP + +int bar(); + +#endif diff --git a/tests/test_cases/deps/shared/baz.cpp b/tests/test_cases/deps/shared/baz.cpp new file mode 100644 index 0000000..fae4845 --- /dev/null +++ b/tests/test_cases/deps/shared/baz.cpp @@ -0,0 +1,8 @@ +#include "foo/foo.hpp" +#include "baz.hpp" +#include <iostream> + +int baz() { + std::cout << "baz\n"; + return foo(); +} diff --git a/tests/test_cases/deps/shared/baz.hpp b/tests/test_cases/deps/shared/baz.hpp new file mode 100644 index 0000000..643cf65 --- /dev/null +++ b/tests/test_cases/deps/shared/baz.hpp @@ -0,0 +1,6 @@ +#ifndef BAZ_HPP +#define BAZ_HPP + +int baz(); + +#endif diff --git a/tests/test_cases/deps/shared/foo.cpp b/tests/test_cases/deps/shared/foo.cpp new file mode 100644 index 0000000..f985022 --- /dev/null +++ b/tests/test_cases/deps/shared/foo.cpp @@ -0,0 +1,7 @@ +#include "foo.hpp" +#include <iostream> + +int foo() { + std::cout << "foo\n"; + return 0; +} diff --git a/tests/test_cases/deps/shared/foo.hpp b/tests/test_cases/deps/shared/foo.hpp new file mode 100644 index 0000000..1a28686 --- /dev/null +++ b/tests/test_cases/deps/shared/foo.hpp @@ -0,0 +1,6 @@ +#ifndef FOO_HPP +#define FOO_HPP + +int foo(); + +#endif diff --git a/tests/test_cases/deps/shared/main_uses_bar.cpp b/tests/test_cases/deps/shared/main_uses_bar.cpp new file mode 100644 index 0000000..9cfc855 --- /dev/null +++ b/tests/test_cases/deps/shared/main_uses_bar.cpp @@ -0,0 +1,8 @@ +#include "bar/bar.hpp" +#include <iostream> + +int main() { + std::cout << "main\n"; + bar(); + return 0; +} diff --git a/tests/test_cases/deps/shared/main_uses_foo.cpp b/tests/test_cases/deps/shared/main_uses_foo.cpp new file mode 100644 index 0000000..0fb3bb6 --- /dev/null +++ b/tests/test_cases/deps/shared/main_uses_foo.cpp @@ -0,0 +1,8 @@ +#include "foo/foo.hpp" +#include <iostream> + +int main() { + std::cout << "main\n"; + foo(); + return 0; +} diff --git a/tests/test_cases/deps/shared/test_diamond.cpp b/tests/test_cases/deps/shared/test_diamond.cpp new file mode 100644 index 0000000..9298230 --- /dev/null +++ b/tests/test_cases/deps/shared/test_diamond.cpp @@ -0,0 +1,4 @@ +#include "baz/baz.hpp" +#include "foo/foo.hpp" + +int main() { return foo() + baz(); } diff --git a/tests/test_cases/deps/shared/test_uses_bar.cpp b/tests/test_cases/deps/shared/test_uses_bar.cpp new file mode 100644 index 0000000..c2076ec --- /dev/null +++ b/tests/test_cases/deps/shared/test_uses_bar.cpp @@ -0,0 +1,3 @@ +#include "bar/bar.hpp" + +int main() { return bar(); } diff --git a/tests/test_cases/deps/shared/test_uses_baz.cpp b/tests/test_cases/deps/shared/test_uses_baz.cpp new file mode 100644 index 0000000..02d67f9 --- /dev/null +++ b/tests/test_cases/deps/shared/test_uses_baz.cpp @@ -0,0 +1,3 @@ +#include "baz/baz.hpp" + +int main() { return baz(); } diff --git a/tests/test_cases/deps/shared/test_uses_foo.cpp b/tests/test_cases/deps/shared/test_uses_foo.cpp new file mode 100644 index 0000000..88feb93 --- /dev/null +++ b/tests/test_cases/deps/shared/test_uses_foo.cpp @@ -0,0 +1,3 @@ +#include "foo/foo.hpp" + +int main() { return foo(); } diff --git a/tests/test_cases/deps/shared/test_uses_main.sh b/tests/test_cases/deps/shared/test_uses_main.sh new file mode 100644 index 0000000..ab8672f --- /dev/null +++ b/tests/test_cases/deps/shared/test_uses_main.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +./main_uses_bar | grep main +./main_uses_bar | grep bar +./main_uses_bar | grep foo |