10 #include <cppunit/TestFixture.h>
11 #include <cppunit/extensions/HelperMacros.h>
13 #include "CompatibilityUtils.hpp"
24 CPPUNIT_TEST(test_license_compatible);
25 CPPUNIT_TEST_SUITE_END();
27 void test_license_compatible();
46 TESTDATADIR
"/comp-rules-test.yaml");
48 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Permissive licenses should be compatible",
50 "Permissive", test_rule_list));
52 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Strong copyleft and weak copyleft licenses "
53 "should not be compatible",
false,
55 "Weak Copyleft", test_rule_list));
57 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"GPL and Apache should not be compatible "
58 "explicitly even with wrong types",
false,
60 "Permissive", test_rule_list));
62 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"GPL and MIT should be compatible explicitly",
64 "Permissive", test_rule_list));
66 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Sleepycat and MIT should not be compatible",
68 "Permissive", test_rule_list));
70 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"License name and type in reverse order should "
71 "be compatible",
true,
73 "Do Not Care", test_rule_list));
75 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"default rule should be false",
77 "What license?",
"Another type", test_rule_list));
map< tuple< string, string, string, string >, bool > initialize_rule_list(const string &file_location)
Read YAML file of rules and parse it as map.
bool are_licenses_compatible(const string &first_name, const string &first_type, const string &second_name, const string &second_type, const map< tuple< string, string, string, string >, bool > &rule_list)
Check the licenses against rules and get the compatibility result.
Test compatibility functions.
void test_license_compatible()
Test are_licenses_compatible()