wurlinc-rice 1.4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +23 -0
- data/Doxyfile +1253 -0
- data/Makefile.am +26 -0
- data/README +1119 -0
- data/README.mingw +8 -0
- data/Rakefile +33 -0
- data/bootstrap +9 -0
- data/configure.ac +52 -0
- data/doxygen.ac +314 -0
- data/doxygen.am +186 -0
- data/extconf.rb +41 -0
- data/post-autoconf.rb +22 -0
- data/post-automake.rb +28 -0
- data/rice/Address_Registration_Guard.hpp +7 -0
- data/rice/Address_Registration_Guard.ipp +34 -0
- data/rice/Address_Registration_Guard_defn.hpp +65 -0
- data/rice/Allocation_Strategies.hpp +37 -0
- data/rice/Arg.hpp +8 -0
- data/rice/Arg_impl.hpp +127 -0
- data/rice/Arg_operators.cpp +21 -0
- data/rice/Arg_operators.hpp +19 -0
- data/rice/Array.hpp +220 -0
- data/rice/Array.ipp +263 -0
- data/rice/Builtin_Object.hpp +8 -0
- data/rice/Builtin_Object.ipp +50 -0
- data/rice/Builtin_Object_defn.hpp +51 -0
- data/rice/Class.cpp +57 -0
- data/rice/Class.hpp +8 -0
- data/rice/Class.ipp +6 -0
- data/rice/Class_defn.hpp +83 -0
- data/rice/Constructor.hpp +367 -0
- data/rice/Critical_Guard.hpp +40 -0
- data/rice/Critical_Guard.ipp +26 -0
- data/rice/Data_Object.hpp +8 -0
- data/rice/Data_Object.ipp +133 -0
- data/rice/Data_Object_defn.hpp +132 -0
- data/rice/Data_Type.cpp +54 -0
- data/rice/Data_Type.hpp +8 -0
- data/rice/Data_Type.ipp +365 -0
- data/rice/Data_Type_defn.hpp +261 -0
- data/rice/Data_Type_fwd.hpp +12 -0
- data/rice/Director.cpp +13 -0
- data/rice/Director.hpp +39 -0
- data/rice/Enum.hpp +117 -0
- data/rice/Enum.ipp +246 -0
- data/rice/Exception.cpp +59 -0
- data/rice/Exception.hpp +9 -0
- data/rice/Exception_Base.hpp +8 -0
- data/rice/Exception_Base.ipp +13 -0
- data/rice/Exception_Base_defn.hpp +27 -0
- data/rice/Exception_defn.hpp +69 -0
- data/rice/Hash.hpp +210 -0
- data/rice/Hash.ipp +338 -0
- data/rice/Identifier.cpp +8 -0
- data/rice/Identifier.hpp +50 -0
- data/rice/Identifier.ipp +33 -0
- data/rice/Jump_Tag.hpp +24 -0
- data/rice/Makefile.am +129 -0
- data/rice/Module.cpp +84 -0
- data/rice/Module.hpp +8 -0
- data/rice/Module.ipp +6 -0
- data/rice/Module_defn.hpp +88 -0
- data/rice/Module_impl.hpp +281 -0
- data/rice/Module_impl.ipp +348 -0
- data/rice/Object.cpp +160 -0
- data/rice/Object.hpp +8 -0
- data/rice/Object.ipp +19 -0
- data/rice/Object_defn.hpp +191 -0
- data/rice/Require_Guard.hpp +21 -0
- data/rice/String.cpp +94 -0
- data/rice/String.hpp +89 -0
- data/rice/Struct.cpp +117 -0
- data/rice/Struct.hpp +162 -0
- data/rice/Struct.ipp +26 -0
- data/rice/Symbol.cpp +25 -0
- data/rice/Symbol.hpp +66 -0
- data/rice/Symbol.ipp +44 -0
- data/rice/VM.cpp +92 -0
- data/rice/VM.hpp +32 -0
- data/rice/config.hpp.in +40 -0
- data/rice/detail/Arguments.hpp +118 -0
- data/rice/detail/Auto_Function_Wrapper.hpp +829 -0
- data/rice/detail/Auto_Function_Wrapper.ipp +3391 -0
- data/rice/detail/Auto_Member_Function_Wrapper.hpp +828 -0
- data/rice/detail/Auto_Member_Function_Wrapper.ipp +2503 -0
- data/rice/detail/Caster.hpp +103 -0
- data/rice/detail/Exception_Handler.hpp +8 -0
- data/rice/detail/Exception_Handler.ipp +68 -0
- data/rice/detail/Exception_Handler_defn.hpp +96 -0
- data/rice/detail/Iterator.hpp +93 -0
- data/rice/detail/Not_Copyable.hpp +25 -0
- data/rice/detail/Wrapped_Function.hpp +33 -0
- data/rice/detail/cfp.hpp +24 -0
- data/rice/detail/cfp.ipp +51 -0
- data/rice/detail/check_ruby_type.cpp +27 -0
- data/rice/detail/check_ruby_type.hpp +23 -0
- data/rice/detail/creation_funcs.hpp +37 -0
- data/rice/detail/creation_funcs.ipp +36 -0
- data/rice/detail/default_allocation_func.hpp +23 -0
- data/rice/detail/default_allocation_func.ipp +11 -0
- data/rice/detail/define_method_and_auto_wrap.hpp +31 -0
- data/rice/detail/define_method_and_auto_wrap.ipp +30 -0
- data/rice/detail/demangle.cpp +56 -0
- data/rice/detail/demangle.hpp +19 -0
- data/rice/detail/env.hpp +19 -0
- data/rice/detail/from_ruby.hpp +43 -0
- data/rice/detail/from_ruby.ipp +60 -0
- data/rice/detail/method_data.cpp +159 -0
- data/rice/detail/method_data.hpp +21 -0
- data/rice/detail/mininode.cpp +1220 -0
- data/rice/detail/mininode.hpp +320 -0
- data/rice/detail/node.hpp +13 -0
- data/rice/detail/object_call.hpp +68 -0
- data/rice/detail/object_call.ipp +131 -0
- data/rice/detail/protect.cpp +29 -0
- data/rice/detail/protect.hpp +34 -0
- data/rice/detail/ruby.hpp +93 -0
- data/rice/detail/ruby_version_code.hpp.in +6 -0
- data/rice/detail/rubysig.hpp +19 -0
- data/rice/detail/st.hpp +60 -0
- data/rice/detail/to_ruby.hpp +22 -0
- data/rice/detail/to_ruby.ipp +36 -0
- data/rice/detail/traits.hpp +43 -0
- data/rice/detail/win32.hpp +16 -0
- data/rice/detail/wrap_function.hpp +341 -0
- data/rice/detail/wrap_function.ipp +514 -0
- data/rice/global_function.hpp +33 -0
- data/rice/global_function.ipp +22 -0
- data/rice/protect.hpp +91 -0
- data/rice/protect.ipp +1133 -0
- data/rice/ruby_mark.hpp +13 -0
- data/rice/ruby_try_catch.hpp +86 -0
- data/rice/rubypp.rb +97 -0
- data/rice/to_from_ruby.hpp +8 -0
- data/rice/to_from_ruby.ipp +297 -0
- data/rice/to_from_ruby_defn.hpp +71 -0
- data/ruby/Makefile.am +1 -0
- data/ruby/lib/Makefile.am +3 -0
- data/ruby/lib/mkmf-rice.rb.in +216 -0
- data/ruby/lib/version.rb +3 -0
- data/ruby.ac +136 -0
- data/sample/Makefile.am +47 -0
- data/sample/enum/extconf.rb +3 -0
- data/sample/enum/sample_enum.cpp +54 -0
- data/sample/enum/test.rb +8 -0
- data/sample/inheritance/animals.cpp +98 -0
- data/sample/inheritance/extconf.rb +3 -0
- data/sample/inheritance/test.rb +7 -0
- data/sample/map/extconf.rb +3 -0
- data/sample/map/map.cpp +81 -0
- data/sample/map/test.rb +7 -0
- data/test/Makefile.am +78 -0
- data/test/ext/Makefile.am +43 -0
- data/test/ext/t1/Foo.hpp +10 -0
- data/test/ext/t1/extconf.rb +2 -0
- data/test/ext/t1/t1.cpp +15 -0
- data/test/ext/t2/extconf.rb +2 -0
- data/test/ext/t2/t2.cpp +11 -0
- data/test/test_Address_Registration_Guard.cpp +43 -0
- data/test/test_Allocation_Strategies.cpp +77 -0
- data/test/test_Array.cpp +241 -0
- data/test/test_Builtin_Object.cpp +72 -0
- data/test/test_Class.cpp +498 -0
- data/test/test_Constructor.cpp +128 -0
- data/test/test_Critical_Guard.cpp +51 -0
- data/test/test_Data_Object.cpp +275 -0
- data/test/test_Data_Type.cpp +348 -0
- data/test/test_Director.cpp +301 -0
- data/test/test_Enum.cpp +195 -0
- data/test/test_Exception.cpp +46 -0
- data/test/test_Hash.cpp +195 -0
- data/test/test_Identifier.cpp +70 -0
- data/test/test_Jump_Tag.cpp +17 -0
- data/test/test_Memory_Management.cpp +50 -0
- data/test/test_Module.cpp +481 -0
- data/test/test_Object.cpp +148 -0
- data/test/test_String.cpp +94 -0
- data/test/test_Struct.cpp +192 -0
- data/test/test_Symbol.cpp +63 -0
- data/test/test_To_From_Ruby.cpp +263 -0
- data/test/test_VM.cpp +26 -0
- data/test/test_global_functions.cpp +114 -0
- data/test/test_rice.rb +43 -0
- data/test/unittest.cpp +136 -0
- data/test/unittest.hpp +292 -0
- metadata +276 -0
data/test/unittest.cpp
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
#include <iostream>
|
2
|
+
#include <map>
|
3
|
+
#include "unittest.hpp"
|
4
|
+
|
5
|
+
size_t assertions;
|
6
|
+
|
7
|
+
namespace
|
8
|
+
{
|
9
|
+
|
10
|
+
typedef std::map<std::string, Test_Suite> Test_Suites;
|
11
|
+
Test_Suite * last_test_suite;
|
12
|
+
|
13
|
+
Test_Suites & test_suites()
|
14
|
+
{
|
15
|
+
static Test_Suites test_suites;
|
16
|
+
return test_suites;
|
17
|
+
}
|
18
|
+
|
19
|
+
} // namespace
|
20
|
+
|
21
|
+
Test_Suite & test_suite()
|
22
|
+
{
|
23
|
+
return *last_test_suite;
|
24
|
+
}
|
25
|
+
|
26
|
+
void new_test_suite(std::string const & name)
|
27
|
+
{
|
28
|
+
test_suites()[name] = Test_Suite(name);
|
29
|
+
last_test_suite = &test_suites()[name];
|
30
|
+
}
|
31
|
+
|
32
|
+
std::ostream & operator<<(std::ostream & out, Failure const & failure)
|
33
|
+
{
|
34
|
+
out << "" << failure.test_suite_name_ << ":" << failure.test_case_name_ << ": " << failure.what_;
|
35
|
+
return out;
|
36
|
+
}
|
37
|
+
|
38
|
+
Test_Suite::
|
39
|
+
Test_Suite(std::string const & name)
|
40
|
+
: name_(name)
|
41
|
+
, setup_(0)
|
42
|
+
, teardown_(0)
|
43
|
+
{
|
44
|
+
}
|
45
|
+
|
46
|
+
void Test_Suite::
|
47
|
+
run(Test_Result & result)
|
48
|
+
{
|
49
|
+
for(Test_Cases::iterator it = test_cases_.begin(),
|
50
|
+
end = test_cases_.end();
|
51
|
+
it != end;
|
52
|
+
++it)
|
53
|
+
{
|
54
|
+
try
|
55
|
+
{
|
56
|
+
std::cout << "" << name() << ":" << it->name() << " ";
|
57
|
+
std::cout.flush();
|
58
|
+
if(setup_)
|
59
|
+
{
|
60
|
+
setup_();
|
61
|
+
}
|
62
|
+
it->run();
|
63
|
+
std::cout << ".";
|
64
|
+
}
|
65
|
+
catch(Assertion_Failed const & ex)
|
66
|
+
{
|
67
|
+
std::cout << "F";
|
68
|
+
result.add_failure(Failure(name(), it->name(), ex.what()));
|
69
|
+
}
|
70
|
+
catch(std::exception const & ex)
|
71
|
+
{
|
72
|
+
std::cout << "E";
|
73
|
+
result.add_error(Failure(name(), it->name(), ex.what()));
|
74
|
+
}
|
75
|
+
catch(...)
|
76
|
+
{
|
77
|
+
std::cout << "E";
|
78
|
+
result.add_error(Failure(name(), it->name(), "Unknown exception"));
|
79
|
+
}
|
80
|
+
if(teardown_)
|
81
|
+
{
|
82
|
+
teardown_();
|
83
|
+
}
|
84
|
+
std::cout << std::endl;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
int main()
|
89
|
+
{
|
90
|
+
Test_Result result;
|
91
|
+
size_t num_tests = 0;
|
92
|
+
|
93
|
+
for(Test_Suites::iterator it = test_suites().begin(),
|
94
|
+
end = test_suites().end();
|
95
|
+
it != end;
|
96
|
+
++it)
|
97
|
+
{
|
98
|
+
it->second.run(result);
|
99
|
+
num_tests += it->second.size();
|
100
|
+
}
|
101
|
+
|
102
|
+
std::cout << std::endl;
|
103
|
+
|
104
|
+
std::cout << num_tests << " test(s), "
|
105
|
+
<< assertions << " assertion(s), "
|
106
|
+
<< result.errors().size() << " error(s), "
|
107
|
+
<< result.failures().size() << " failure(s)"
|
108
|
+
<< std::endl;
|
109
|
+
|
110
|
+
if(result.errors().size() > 0)
|
111
|
+
{
|
112
|
+
std::cout << std::endl << "Errors:" << std::endl;
|
113
|
+
for(std::vector<Failure>::const_iterator it = result.errors().begin(),
|
114
|
+
end = result.errors().end();
|
115
|
+
it != end;
|
116
|
+
++it)
|
117
|
+
{
|
118
|
+
std::cout << *it << std::endl;
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
if(result.failures().size() > 0)
|
123
|
+
{
|
124
|
+
std::cout << std::endl << "Failures:" << std::endl;
|
125
|
+
for(std::vector<Failure>::const_iterator it = result.failures().begin(),
|
126
|
+
end = result.failures().end();
|
127
|
+
it != end;
|
128
|
+
++it)
|
129
|
+
{
|
130
|
+
std::cout << *it << std::endl;
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
134
|
+
return result.errors().size() + result.failures().size();
|
135
|
+
}
|
136
|
+
|
data/test/unittest.hpp
ADDED
@@ -0,0 +1,292 @@
|
|
1
|
+
#ifndef unittest__hpp_
|
2
|
+
#define unittest__hpp_
|
3
|
+
|
4
|
+
/*! \file
|
5
|
+
* \brief A (very) simple unit test framework.
|
6
|
+
*/
|
7
|
+
|
8
|
+
#if defined(_MSC_VER)
|
9
|
+
#define NOMINMAX
|
10
|
+
#else
|
11
|
+
using namespace std;
|
12
|
+
#endif
|
13
|
+
|
14
|
+
#include <vector>
|
15
|
+
#include <string>
|
16
|
+
#include <stdexcept>
|
17
|
+
#include <sstream>
|
18
|
+
#include <iostream>
|
19
|
+
|
20
|
+
class Failure
|
21
|
+
{
|
22
|
+
public:
|
23
|
+
Failure(
|
24
|
+
std::string const & test_suite_name,
|
25
|
+
std::string const & test_case_name,
|
26
|
+
std::string what)
|
27
|
+
: test_suite_name_(test_suite_name)
|
28
|
+
, test_case_name_(test_case_name)
|
29
|
+
, what_(what)
|
30
|
+
{
|
31
|
+
}
|
32
|
+
|
33
|
+
friend std::ostream & operator<<(std::ostream & out, Failure const & failure);
|
34
|
+
|
35
|
+
private:
|
36
|
+
std::string test_suite_name_;
|
37
|
+
std::string test_case_name_;
|
38
|
+
std::string what_;
|
39
|
+
};
|
40
|
+
|
41
|
+
class Test_Result
|
42
|
+
{
|
43
|
+
public:
|
44
|
+
void add_failure(Failure const & failure)
|
45
|
+
{
|
46
|
+
failures_.push_back(failure);
|
47
|
+
}
|
48
|
+
|
49
|
+
void add_error(Failure const & failure)
|
50
|
+
{
|
51
|
+
errors_.push_back(failure);
|
52
|
+
}
|
53
|
+
|
54
|
+
std::vector<Failure> const & failures() const
|
55
|
+
{
|
56
|
+
return failures_;
|
57
|
+
}
|
58
|
+
|
59
|
+
std::vector<Failure> const & errors() const
|
60
|
+
{
|
61
|
+
return errors_;
|
62
|
+
}
|
63
|
+
|
64
|
+
private:
|
65
|
+
std::vector<Failure> failures_;
|
66
|
+
std::vector<Failure> errors_;
|
67
|
+
};
|
68
|
+
|
69
|
+
class Test_Case
|
70
|
+
{
|
71
|
+
public:
|
72
|
+
typedef void (*Func)();
|
73
|
+
|
74
|
+
Test_Case(
|
75
|
+
std::string const & name,
|
76
|
+
Func f)
|
77
|
+
: name_(name)
|
78
|
+
, f_(f)
|
79
|
+
{
|
80
|
+
}
|
81
|
+
|
82
|
+
void run()
|
83
|
+
{
|
84
|
+
f_();
|
85
|
+
}
|
86
|
+
|
87
|
+
std::string const & name() const { return name_; }
|
88
|
+
|
89
|
+
size_t size() const { return 1; }
|
90
|
+
|
91
|
+
private:
|
92
|
+
std::string name_;
|
93
|
+
Func f_;
|
94
|
+
};
|
95
|
+
|
96
|
+
class Test_Suite
|
97
|
+
{
|
98
|
+
public:
|
99
|
+
Test_Suite(std::string const & name = "");
|
100
|
+
|
101
|
+
void add_test_case(Test_Case const & test_case)
|
102
|
+
{
|
103
|
+
test_cases_.push_back(test_case);
|
104
|
+
}
|
105
|
+
|
106
|
+
void setup(void (*f)()) { setup_ = f; }
|
107
|
+
void teardown(void (*f)()) { teardown_ = f; }
|
108
|
+
|
109
|
+
void run(Test_Result & result);
|
110
|
+
|
111
|
+
std::string const & name() const { return name_; }
|
112
|
+
|
113
|
+
size_t size() const { return test_cases_.size(); }
|
114
|
+
|
115
|
+
private:
|
116
|
+
std::string name_;
|
117
|
+
|
118
|
+
typedef std::vector<Test_Case> Test_Cases;
|
119
|
+
Test_Cases test_cases_;
|
120
|
+
|
121
|
+
void (*setup_)();
|
122
|
+
void (*teardown_)();
|
123
|
+
};
|
124
|
+
|
125
|
+
|
126
|
+
Test_Suite & test_suite();
|
127
|
+
void new_test_suite(std::string const & name);
|
128
|
+
|
129
|
+
class Assertion_Failed
|
130
|
+
: public std::runtime_error
|
131
|
+
{
|
132
|
+
public:
|
133
|
+
Assertion_Failed(std::string const & what)
|
134
|
+
: std::runtime_error(what)
|
135
|
+
{
|
136
|
+
}
|
137
|
+
};
|
138
|
+
|
139
|
+
|
140
|
+
// TODO: not sure how to append __LINE__ correctly here
|
141
|
+
#define UNIQUE_SUITE_NAME(prefix, name) \
|
142
|
+
prefix ## __ ## name \
|
143
|
+
|
144
|
+
#define TESTSUITE(name) \
|
145
|
+
struct UNIQUE_SUITE_NAME(testsuite_append, name) \
|
146
|
+
{ \
|
147
|
+
UNIQUE_SUITE_NAME(testsuite_append, name)() \
|
148
|
+
{ \
|
149
|
+
new_test_suite(#name); \
|
150
|
+
} \
|
151
|
+
} UNIQUE_SUITE_NAME(testsuite_append__initializer, name)
|
152
|
+
|
153
|
+
#define TESTCASE(name) \
|
154
|
+
static void UNIQUE_SUITE_NAME(test, name)(); \
|
155
|
+
\
|
156
|
+
namespace \
|
157
|
+
{ \
|
158
|
+
struct UNIQUE_SUITE_NAME(test_append, name) \
|
159
|
+
{ \
|
160
|
+
UNIQUE_SUITE_NAME(test_append, name)() \
|
161
|
+
{ \
|
162
|
+
test_suite().add_test_case( \
|
163
|
+
Test_Case(#name, & UNIQUE_SUITE_NAME(test, name))); \
|
164
|
+
} \
|
165
|
+
} UNIQUE_SUITE_NAME(test_append__initializer, name); \
|
166
|
+
} \
|
167
|
+
\
|
168
|
+
static void UNIQUE_SUITE_NAME(test, name)()
|
169
|
+
|
170
|
+
#define TESTFIXTURE(name, type) \
|
171
|
+
static void UNIQUE_SUITE_NAME(fixture ## __ ## name, type)(); \
|
172
|
+
\
|
173
|
+
namespace \
|
174
|
+
{ \
|
175
|
+
struct UNIQUE_SUITE_NAME(fixture_append ## __ ## name, type) \
|
176
|
+
{ \
|
177
|
+
UNIQUE_SUITE_NAME(fixture_append ## __ ## name, type)() \
|
178
|
+
{ \
|
179
|
+
test_suite().type(UNIQUE_SUITE_NAME(fixture ## __ ## name, type)); \
|
180
|
+
} \
|
181
|
+
} UNIQUE_SUITE_NAME(fixture_append__initializer ## __ ## name, type); \
|
182
|
+
} \
|
183
|
+
\
|
184
|
+
static void UNIQUE_SUITE_NAME(fixture ## __ ## name, type)()
|
185
|
+
|
186
|
+
#define SETUP(name) TESTFIXTURE(name, setup)
|
187
|
+
|
188
|
+
#define TEARDOWN(name) TESTFIXTURE(name, teardown)
|
189
|
+
|
190
|
+
template<typename RHS_T, typename LHS_T>
|
191
|
+
inline bool is_equal(RHS_T const & rhs, LHS_T const & lhs)
|
192
|
+
{
|
193
|
+
return rhs == lhs;
|
194
|
+
}
|
195
|
+
|
196
|
+
inline bool is_equal(char const * lhs, char const * rhs)
|
197
|
+
{
|
198
|
+
return std::string(lhs) == std::string(rhs);
|
199
|
+
}
|
200
|
+
|
201
|
+
inline bool is_equal(char * lhs, char const * rhs)
|
202
|
+
{
|
203
|
+
return std::string(lhs) == std::string(rhs);
|
204
|
+
}
|
205
|
+
|
206
|
+
inline bool is_equal(char const * lhs, char * rhs)
|
207
|
+
{
|
208
|
+
return std::string(lhs) == std::string(rhs);
|
209
|
+
}
|
210
|
+
|
211
|
+
template<typename T, typename U>
|
212
|
+
inline bool is_not_equal(T const & t, U const & u)
|
213
|
+
{
|
214
|
+
return !is_equal(t, u);
|
215
|
+
}
|
216
|
+
|
217
|
+
extern size_t assertions;
|
218
|
+
|
219
|
+
template<typename T, typename U>
|
220
|
+
void assert_equal(
|
221
|
+
T const & t,
|
222
|
+
U const & u,
|
223
|
+
std::string const & s_t,
|
224
|
+
std::string const & s_u,
|
225
|
+
std::string const & file,
|
226
|
+
size_t line)
|
227
|
+
{
|
228
|
+
if(!is_equal(t, u))
|
229
|
+
{
|
230
|
+
std::stringstream strm;
|
231
|
+
strm << "Assertion failed: "
|
232
|
+
<< s_t << " != " << s_u
|
233
|
+
<< " (" << t << " != " << u << ")"
|
234
|
+
<< " at " << file << ":" << line;
|
235
|
+
throw Assertion_Failed(strm.str());
|
236
|
+
}
|
237
|
+
}
|
238
|
+
|
239
|
+
template<typename T, typename U>
|
240
|
+
void assert_not_equal(
|
241
|
+
T const & t,
|
242
|
+
U const & u,
|
243
|
+
std::string const & s_t,
|
244
|
+
std::string const & s_u,
|
245
|
+
std::string const & file,
|
246
|
+
size_t line)
|
247
|
+
{
|
248
|
+
if(!is_not_equal(t, u))
|
249
|
+
{
|
250
|
+
std::stringstream strm;
|
251
|
+
strm << "Assertion failed: "
|
252
|
+
<< s_t << " should != " << s_u
|
253
|
+
<< " (" << t << " should != " << u << ")"
|
254
|
+
<< " at " << file << ":" << line;
|
255
|
+
throw Assertion_Failed(strm.str());
|
256
|
+
}
|
257
|
+
}
|
258
|
+
|
259
|
+
#define ASSERT_EQUAL(x, y) \
|
260
|
+
do \
|
261
|
+
{ \
|
262
|
+
++assertions; \
|
263
|
+
assert_equal((x), (y), #x, #y, __FILE__, __LINE__); \
|
264
|
+
} while(0)
|
265
|
+
|
266
|
+
#define ASSERT_NOT_EQUAL(x, y) \
|
267
|
+
do \
|
268
|
+
{ \
|
269
|
+
++assertions; \
|
270
|
+
assert_not_equal((x), (y), #x, #y, __FILE__, __LINE__); \
|
271
|
+
} while(0)
|
272
|
+
|
273
|
+
#define ASSERT(x) \
|
274
|
+
ASSERT_EQUAL(true, !!x);
|
275
|
+
|
276
|
+
#define ASSERT_EXCEPTION_CHECK(type, code, check_exception) \
|
277
|
+
try \
|
278
|
+
{ \
|
279
|
+
++assertions; \
|
280
|
+
code; \
|
281
|
+
ASSERT(!"Expected exception"); \
|
282
|
+
} \
|
283
|
+
catch(type const & ex) \
|
284
|
+
{ \
|
285
|
+
check_exception; \
|
286
|
+
}
|
287
|
+
|
288
|
+
#define ASSERT_EXCEPTION(type, code) \
|
289
|
+
ASSERT_EXCEPTION_CHECK(type, code, )
|
290
|
+
|
291
|
+
#endif
|
292
|
+
|
metadata
ADDED
@@ -0,0 +1,276 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: wurlinc-rice
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 125
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
- 1
|
11
|
+
version: 1.4.0.1
|
12
|
+
platform: ruby
|
13
|
+
authors:
|
14
|
+
- Paul Brannan
|
15
|
+
- Jason Roelofs
|
16
|
+
- David Martinez
|
17
|
+
autorequire:
|
18
|
+
bindir: bin
|
19
|
+
cert_chain: []
|
20
|
+
|
21
|
+
date: 2011-06-20 00:00:00 -07:00
|
22
|
+
default_executable:
|
23
|
+
dependencies:
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: rubyforge
|
26
|
+
prerelease: false
|
27
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
hash: 3
|
33
|
+
segments:
|
34
|
+
- 0
|
35
|
+
version: "0"
|
36
|
+
type: :development
|
37
|
+
version_requirements: *id001
|
38
|
+
description: |
|
39
|
+
Rice is a C++ interface to Ruby's C API. It provides a type-safe and
|
40
|
+
exception-safe interface in order to make embedding Ruby and writing
|
41
|
+
Ruby extensions with C++ easier. It is similar to Boost.Python in many
|
42
|
+
ways, but also attempts to provide an object-oriented interface to all
|
43
|
+
of the Ruby C API.
|
44
|
+
|
45
|
+
email:
|
46
|
+
- curlypaul924@gmail.com
|
47
|
+
- jameskilton@gmail.com
|
48
|
+
- david@hackerdude.com
|
49
|
+
executables: []
|
50
|
+
|
51
|
+
extensions:
|
52
|
+
- extconf.rb
|
53
|
+
extra_rdoc_files:
|
54
|
+
- README
|
55
|
+
files:
|
56
|
+
- COPYING
|
57
|
+
- README
|
58
|
+
- README.mingw
|
59
|
+
- Doxyfile
|
60
|
+
- doxygen.ac
|
61
|
+
- doxygen.am
|
62
|
+
- extconf.rb
|
63
|
+
- bootstrap
|
64
|
+
- configure.ac
|
65
|
+
- post-autoconf.rb
|
66
|
+
- post-automake.rb
|
67
|
+
- ruby.ac
|
68
|
+
- Rakefile
|
69
|
+
- Makefile.am
|
70
|
+
- rice/Makefile.am
|
71
|
+
- ruby/Makefile.am
|
72
|
+
- ruby/lib/Makefile.am
|
73
|
+
- sample/Makefile.am
|
74
|
+
- test/Makefile.am
|
75
|
+
- rice/Address_Registration_Guard.hpp
|
76
|
+
- rice/Address_Registration_Guard.ipp
|
77
|
+
- rice/Address_Registration_Guard_defn.hpp
|
78
|
+
- rice/Allocation_Strategies.hpp
|
79
|
+
- rice/Arg.hpp
|
80
|
+
- rice/Arg_impl.hpp
|
81
|
+
- rice/Arg_operators.cpp
|
82
|
+
- rice/Arg_operators.hpp
|
83
|
+
- rice/Array.hpp
|
84
|
+
- rice/Array.ipp
|
85
|
+
- rice/Builtin_Object.hpp
|
86
|
+
- rice/Builtin_Object.ipp
|
87
|
+
- rice/Builtin_Object_defn.hpp
|
88
|
+
- rice/Class.cpp
|
89
|
+
- rice/Class.hpp
|
90
|
+
- rice/Class.ipp
|
91
|
+
- rice/Class_defn.hpp
|
92
|
+
- rice/Constructor.hpp
|
93
|
+
- rice/Critical_Guard.hpp
|
94
|
+
- rice/Critical_Guard.ipp
|
95
|
+
- rice/Data_Object.hpp
|
96
|
+
- rice/Data_Object.ipp
|
97
|
+
- rice/Data_Object_defn.hpp
|
98
|
+
- rice/Data_Type.cpp
|
99
|
+
- rice/Data_Type.hpp
|
100
|
+
- rice/Data_Type.ipp
|
101
|
+
- rice/Data_Type_defn.hpp
|
102
|
+
- rice/Data_Type_fwd.hpp
|
103
|
+
- rice/Director.cpp
|
104
|
+
- rice/Director.hpp
|
105
|
+
- rice/Enum.hpp
|
106
|
+
- rice/Enum.ipp
|
107
|
+
- rice/Exception.cpp
|
108
|
+
- rice/Exception.hpp
|
109
|
+
- rice/Exception_Base.hpp
|
110
|
+
- rice/Exception_Base.ipp
|
111
|
+
- rice/Exception_Base_defn.hpp
|
112
|
+
- rice/Exception_defn.hpp
|
113
|
+
- rice/global_function.hpp
|
114
|
+
- rice/global_function.ipp
|
115
|
+
- rice/Hash.hpp
|
116
|
+
- rice/Hash.ipp
|
117
|
+
- rice/Identifier.cpp
|
118
|
+
- rice/Identifier.hpp
|
119
|
+
- rice/Identifier.ipp
|
120
|
+
- rice/Jump_Tag.hpp
|
121
|
+
- rice/Module.cpp
|
122
|
+
- rice/Module.hpp
|
123
|
+
- rice/Module.ipp
|
124
|
+
- rice/Module_defn.hpp
|
125
|
+
- rice/Module_impl.hpp
|
126
|
+
- rice/Module_impl.ipp
|
127
|
+
- rice/Object.cpp
|
128
|
+
- rice/Object.hpp
|
129
|
+
- rice/Object.ipp
|
130
|
+
- rice/Object_defn.hpp
|
131
|
+
- rice/protect.hpp
|
132
|
+
- rice/protect.ipp
|
133
|
+
- rice/Require_Guard.hpp
|
134
|
+
- rice/ruby_mark.hpp
|
135
|
+
- rice/ruby_try_catch.hpp
|
136
|
+
- rice/String.cpp
|
137
|
+
- rice/String.hpp
|
138
|
+
- rice/Struct.cpp
|
139
|
+
- rice/Struct.hpp
|
140
|
+
- rice/Struct.ipp
|
141
|
+
- rice/Symbol.cpp
|
142
|
+
- rice/Symbol.hpp
|
143
|
+
- rice/Symbol.ipp
|
144
|
+
- rice/to_from_ruby.hpp
|
145
|
+
- rice/to_from_ruby.ipp
|
146
|
+
- rice/to_from_ruby_defn.hpp
|
147
|
+
- rice/VM.cpp
|
148
|
+
- rice/VM.hpp
|
149
|
+
- rice/rubypp.rb
|
150
|
+
- rice/config.hpp.in
|
151
|
+
- rice/detail/Arguments.hpp
|
152
|
+
- rice/detail/Auto_Function_Wrapper.hpp
|
153
|
+
- rice/detail/Auto_Function_Wrapper.ipp
|
154
|
+
- rice/detail/Auto_Member_Function_Wrapper.hpp
|
155
|
+
- rice/detail/Auto_Member_Function_Wrapper.ipp
|
156
|
+
- rice/detail/Caster.hpp
|
157
|
+
- rice/detail/cfp.hpp
|
158
|
+
- rice/detail/cfp.ipp
|
159
|
+
- rice/detail/check_ruby_type.cpp
|
160
|
+
- rice/detail/check_ruby_type.hpp
|
161
|
+
- rice/detail/creation_funcs.hpp
|
162
|
+
- rice/detail/creation_funcs.ipp
|
163
|
+
- rice/detail/default_allocation_func.hpp
|
164
|
+
- rice/detail/default_allocation_func.ipp
|
165
|
+
- rice/detail/define_method_and_auto_wrap.hpp
|
166
|
+
- rice/detail/define_method_and_auto_wrap.ipp
|
167
|
+
- rice/detail/demangle.cpp
|
168
|
+
- rice/detail/demangle.hpp
|
169
|
+
- rice/detail/env.hpp
|
170
|
+
- rice/detail/Exception_Handler.hpp
|
171
|
+
- rice/detail/Exception_Handler.ipp
|
172
|
+
- rice/detail/Exception_Handler_defn.hpp
|
173
|
+
- rice/detail/from_ruby.hpp
|
174
|
+
- rice/detail/from_ruby.ipp
|
175
|
+
- rice/detail/Iterator.hpp
|
176
|
+
- rice/detail/method_data.cpp
|
177
|
+
- rice/detail/method_data.hpp
|
178
|
+
- rice/detail/mininode.cpp
|
179
|
+
- rice/detail/mininode.hpp
|
180
|
+
- rice/detail/node.hpp
|
181
|
+
- rice/detail/Not_Copyable.hpp
|
182
|
+
- rice/detail/object_call.hpp
|
183
|
+
- rice/detail/object_call.ipp
|
184
|
+
- rice/detail/protect.cpp
|
185
|
+
- rice/detail/protect.hpp
|
186
|
+
- rice/detail/ruby.hpp
|
187
|
+
- rice/detail/rubysig.hpp
|
188
|
+
- rice/detail/st.hpp
|
189
|
+
- rice/detail/to_ruby.hpp
|
190
|
+
- rice/detail/to_ruby.ipp
|
191
|
+
- rice/detail/traits.hpp
|
192
|
+
- rice/detail/win32.hpp
|
193
|
+
- rice/detail/wrap_function.hpp
|
194
|
+
- rice/detail/wrap_function.ipp
|
195
|
+
- rice/detail/Wrapped_Function.hpp
|
196
|
+
- rice/detail/ruby_version_code.hpp.in
|
197
|
+
- ruby/lib/mkmf-rice.rb.in
|
198
|
+
- ruby/lib/version.rb
|
199
|
+
- sample/enum/extconf.rb
|
200
|
+
- sample/enum/sample_enum.cpp
|
201
|
+
- sample/enum/test.rb
|
202
|
+
- sample/map/extconf.rb
|
203
|
+
- sample/map/map.cpp
|
204
|
+
- sample/map/test.rb
|
205
|
+
- sample/inheritance/extconf.rb
|
206
|
+
- sample/inheritance/animals.cpp
|
207
|
+
- sample/inheritance/test.rb
|
208
|
+
- test/test_Address_Registration_Guard.cpp
|
209
|
+
- test/test_Allocation_Strategies.cpp
|
210
|
+
- test/test_Array.cpp
|
211
|
+
- test/test_Builtin_Object.cpp
|
212
|
+
- test/test_Class.cpp
|
213
|
+
- test/test_Constructor.cpp
|
214
|
+
- test/test_Critical_Guard.cpp
|
215
|
+
- test/test_Data_Object.cpp
|
216
|
+
- test/test_Data_Type.cpp
|
217
|
+
- test/test_Director.cpp
|
218
|
+
- test/test_Enum.cpp
|
219
|
+
- test/test_Exception.cpp
|
220
|
+
- test/test_global_functions.cpp
|
221
|
+
- test/test_Hash.cpp
|
222
|
+
- test/test_Identifier.cpp
|
223
|
+
- test/test_Jump_Tag.cpp
|
224
|
+
- test/test_Memory_Management.cpp
|
225
|
+
- test/test_Module.cpp
|
226
|
+
- test/test_Object.cpp
|
227
|
+
- test/test_String.cpp
|
228
|
+
- test/test_Struct.cpp
|
229
|
+
- test/test_Symbol.cpp
|
230
|
+
- test/test_To_From_Ruby.cpp
|
231
|
+
- test/test_VM.cpp
|
232
|
+
- test/unittest.cpp
|
233
|
+
- test/unittest.hpp
|
234
|
+
- test/ext/Makefile.am
|
235
|
+
- test/ext/t1/extconf.rb
|
236
|
+
- test/ext/t1/Foo.hpp
|
237
|
+
- test/ext/t1/t1.cpp
|
238
|
+
- test/ext/t2/extconf.rb
|
239
|
+
- test/ext/t2/t2.cpp
|
240
|
+
- test/test_rice.rb
|
241
|
+
has_rdoc: true
|
242
|
+
homepage: http://rice.rubyforge.org/
|
243
|
+
licenses: []
|
244
|
+
|
245
|
+
post_install_message:
|
246
|
+
rdoc_options: []
|
247
|
+
|
248
|
+
require_paths:
|
249
|
+
- ruby/lib
|
250
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
251
|
+
none: false
|
252
|
+
requirements:
|
253
|
+
- - ">="
|
254
|
+
- !ruby/object:Gem::Version
|
255
|
+
hash: 3
|
256
|
+
segments:
|
257
|
+
- 0
|
258
|
+
version: "0"
|
259
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
260
|
+
none: false
|
261
|
+
requirements:
|
262
|
+
- - ">="
|
263
|
+
- !ruby/object:Gem::Version
|
264
|
+
hash: 3
|
265
|
+
segments:
|
266
|
+
- 0
|
267
|
+
version: "0"
|
268
|
+
requirements: []
|
269
|
+
|
270
|
+
rubyforge_project: rice
|
271
|
+
rubygems_version: 1.3.7
|
272
|
+
signing_key:
|
273
|
+
specification_version: 3
|
274
|
+
summary: Ruby Interface for C++ Extensions
|
275
|
+
test_files:
|
276
|
+
- test/test_rice.rb
|