<commit_before>#include <vector>
#include <string>

#include <gtest/gtest.h>
#include <qi/log.hpp>
#include <qi/application.hpp>
#include <qi/anymodule.hpp>
#include <qi/anyobject.hpp>

#include "cat.hpp"

///
/// \brief TEST
/// The dynamic library used for these tests is compiled from
/// test_packages_anymodule.cpp
///

TEST(TestPackage, TestFreeFunctions)
{
    qi::AnyModule pkg = ::qi::import("qi_test_anymodule");
    ASSERT_NE(pkg, NULL);

    int r;

    pkg.call<void>("my_void_function", r);
    ASSERT_EQ(r, 44);
    r = pkg.call<int>("my_scl_func");
    ASSERT_EQ(r, 45);

    qi::AnyObject c = pkg.call<qi::AnyObject>("my_cat_returner");

    ASSERT_EQ(c.call<int>("meow"), 15);
}

TEST(TestPackage, FactoryCreatesFunctionalObject)
{
    qi::AnyModule pkg = ::qi::import("qi_test_anymodule");

    ASSERT_NE(pkg, NULL);

    qi::AnyObject obj = pkg.call<qi::AnyObject>("Cat");
    obj.setProperty("meowVolume", ::qi::AnyValue::from(42));
    int result = obj.call<int>("meow");

    ASSERT_EQ(result, 42);
}

int main(int ac, char **av)<commit_msg>Fix gtest warning ASSERT_NE(ptr, NULL) doesn't work well<commit_after>#include <vector>
#include <string>

#include <gtest/gtest.h>
#include <qi/log.hpp>
#include <qi/application.hpp>
#include <qi/anymodule.hpp>
#include <qi/anyobject.hpp>

#include "cat.hpp"

///
/// \brief TEST
/// The dynamic library used for these tests is compiled from
/// test_packages_anymodule.cpp
///

TEST(TestPackage, TestFreeFunctions)
{
    qi::AnyModule pkg = ::qi::import("qi_test_anymodule");
    ASSERT_TRUE(pkg != 0);

    int r;

    pkg.call<void>("my_void_function", r);
    ASSERT_EQ(r, 44);
    r = pkg.call<int>("my_scl_func");
    ASSERT_EQ(r, 45);

    qi::AnyObject c = pkg.call<qi::AnyObject>("my_cat_returner");

    ASSERT_EQ(c.call<int>("meow"), 15);
}

TEST(TestPackage, FactoryCreatesFunctionalObject)
{
    qi::AnyModule pkg = ::qi::import("qi_test_anymodule");

    ASSERT_TRUE(pkg != 0);

    qi::AnyObject obj = pkg.call<qi::AnyObject>("Cat");
    obj.setProperty("meowVolume", ::qi::AnyValue::from(42));
    int result = obj.call<int>("meow");

    ASSERT_EQ(result, 42);
}

int main(int ac, char **av)
{'fraction_non_alphanumeric': 0.18131615278416935, 'fraction_numerical': 0.010124252185918085, 'mean_word_length': 4.435, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '900981', 'n_tokens_mistral': 875, 'n_tokens_neox': 808, 'n_words': 152}