gecoder 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COPYING +17 -0
- data/LGPL-LICENSE +458 -0
- data/README +20 -0
- data/Rakefile +6 -0
- data/ext/extconf.rb +29 -0
- data/ext/missing.cpp +295 -0
- data/ext/missing.h +116 -0
- data/ext/vararray.cpp +312 -0
- data/ext/vararray.h +146 -0
- data/lib/gecoder.rb +4 -0
- data/lib/gecoder/bindings.rb +7 -0
- data/lib/gecoder/bindings/bindings.rb +2055 -0
- data/lib/gecoder/interface.rb +6 -0
- data/lib/gecoder/interface/binding_changes.rb +111 -0
- data/lib/gecoder/interface/branch.rb +102 -0
- data/lib/gecoder/interface/constraints.rb +10 -0
- data/lib/gecoder/interface/constraints/distinct.rb +15 -0
- data/lib/gecoder/interface/constraints/linear.rb +158 -0
- data/lib/gecoder/interface/constraints/relation.rb +76 -0
- data/lib/gecoder/interface/enum_wrapper.rb +64 -0
- data/lib/gecoder/interface/model.rb +130 -0
- data/lib/gecoder/interface/search.rb +23 -0
- data/vendor/rust/README +28 -0
- data/vendor/rust/bin/cxxgenerator.rb +93 -0
- data/vendor/rust/include/rust_checks.hh +115 -0
- data/vendor/rust/include/rust_conversions.hh +103 -0
- data/vendor/rust/rust.rb +67 -0
- data/vendor/rust/rust/attribute.rb +51 -0
- data/vendor/rust/rust/bindings.rb +172 -0
- data/vendor/rust/rust/class.rb +334 -0
- data/vendor/rust/rust/constants.rb +48 -0
- data/vendor/rust/rust/container.rb +110 -0
- data/vendor/rust/rust/cppifaceparser.rb +129 -0
- data/vendor/rust/rust/cwrapper.rb +72 -0
- data/vendor/rust/rust/cxxclass.rb +98 -0
- data/vendor/rust/rust/element.rb +81 -0
- data/vendor/rust/rust/enum.rb +63 -0
- data/vendor/rust/rust/function.rb +407 -0
- data/vendor/rust/rust/namespace.rb +61 -0
- data/vendor/rust/rust/templates/AttributeDefinition.rusttpl +17 -0
- data/vendor/rust/rust/templates/AttributeInitBinding.rusttpl +9 -0
- data/vendor/rust/rust/templates/BindingsHeader.rusttpl +24 -0
- data/vendor/rust/rust/templates/BindingsUnit.rusttpl +46 -0
- data/vendor/rust/rust/templates/CWrapperClassDefinitions.rusttpl +64 -0
- data/vendor/rust/rust/templates/ClassDeclarations.rusttpl +7 -0
- data/vendor/rust/rust/templates/ClassInitialize.rusttpl +6 -0
- data/vendor/rust/rust/templates/ConstructorStub.rusttpl +21 -0
- data/vendor/rust/rust/templates/CxxClassDefinitions.rusttpl +91 -0
- data/vendor/rust/rust/templates/CxxMethodStub.rusttpl +12 -0
- data/vendor/rust/rust/templates/CxxStandaloneClassDefinitions.rusttpl +12 -0
- data/vendor/rust/rust/templates/EnumDeclarations.rusttpl +3 -0
- data/vendor/rust/rust/templates/EnumDefinitions.rusttpl +29 -0
- data/vendor/rust/rust/templates/FunctionDefinition.rusttpl +9 -0
- data/vendor/rust/rust/templates/FunctionInitAlias.rusttpl +5 -0
- data/vendor/rust/rust/templates/FunctionInitBinding.rusttpl +9 -0
- data/vendor/rust/rust/templates/MethodInitBinding.rusttpl +9 -0
- data/vendor/rust/rust/templates/ModuleDeclarations.rusttpl +3 -0
- data/vendor/rust/rust/templates/ModuleDefinitions.rusttpl +3 -0
- data/vendor/rust/rust/templates/StandaloneClassDeclarations.rusttpl +5 -0
- data/vendor/rust/rust/templates/VariableFunctionCall.rusttpl +14 -0
- data/vendor/rust/rust/type.rb +98 -0
- data/vendor/rust/test/Makefile +4 -0
- data/vendor/rust/test/constants.rb +35 -0
- data/vendor/rust/test/cppclass.cc +40 -0
- data/vendor/rust/test/cppclass.hh +63 -0
- data/vendor/rust/test/cppclass.rb +59 -0
- data/vendor/rust/test/cwrapper.c +74 -0
- data/vendor/rust/test/cwrapper.h +41 -0
- data/vendor/rust/test/cwrapper.rb +56 -0
- data/vendor/rust/test/dummyclass.hh +31 -0
- data/vendor/rust/test/lib/extension-test.rb +98 -0
- data/vendor/rust/test/test-constants.rb +43 -0
- data/vendor/rust/test/test-cppclass.rb +82 -0
- data/vendor/rust/test/test-cwrapper.rb +77 -0
- metadata +144 -0
@@ -0,0 +1,56 @@
|
|
1
|
+
# Copyright (c) 2007 Diego Pettenò <flameeyes@gmail.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge,
|
7
|
+
# publish, distribute, sublicense, and/or sell copies of the Software,
|
8
|
+
# and to permit persons to whom the Software is furnished to do so,
|
9
|
+
# subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
18
|
+
# BE LIABLE
|
19
|
+
# FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
20
|
+
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
|
23
|
+
require 'rust'
|
24
|
+
|
25
|
+
Rust::Bindings::create_bindings Rust::Bindings::LangC, "cwrapper_rb" do |b|
|
26
|
+
b.include_header 'cwrapper.h', Rust::Bindings::HeaderLocal
|
27
|
+
|
28
|
+
b.add_namespace "RustTestCWrapper", "" do |ns|
|
29
|
+
ns.add_class_wrapper 'TestClass', 'test_wrapper_t' do |klass|
|
30
|
+
klass.add_constructor 'cwrapper_alloc'
|
31
|
+
|
32
|
+
klass.add_method 'cwrapper_get_integer', 'uint32_t', 'get_integer' do |method|
|
33
|
+
method.add_instance_parameter
|
34
|
+
end
|
35
|
+
klass.add_method 'cwrapper_get_string', 'char*', 'get_string' do |method|
|
36
|
+
method.add_instance_parameter
|
37
|
+
end
|
38
|
+
|
39
|
+
klass.add_method 'cwrapper_set_string', 'bool', 'set_string' do |method|
|
40
|
+
method.add_instance_parameter
|
41
|
+
method.add_parameter "char *", "string"
|
42
|
+
end
|
43
|
+
|
44
|
+
klass.add_method 'cwrapper_set_integer', 'void', 'set_integer' do |method|
|
45
|
+
method.add_instance_parameter
|
46
|
+
method.add_parameter "uint32_t", "integer"
|
47
|
+
end
|
48
|
+
|
49
|
+
klass.add_cleanup_function 'cwrapper_free((test_wrapper_t*)p);'
|
50
|
+
end
|
51
|
+
|
52
|
+
ns.add_function 'cwrapper_get_default_integer', 'uint32_t', 'get_default_integer'
|
53
|
+
|
54
|
+
ns.add_constant 'TestConstant', '1985'
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
/* Copyright (c) 2007 Diego Pettenò <flameeyes@gmail.com>
|
2
|
+
*
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
* a copy of this software and associated documentation files (the
|
5
|
+
* "Software"), to deal in the Software without restriction, including
|
6
|
+
* without limitation the rights to use, copy, modify, merge,
|
7
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
8
|
+
* and to permit persons to whom the Software is furnished to do so,
|
9
|
+
* subject to the following conditions:
|
10
|
+
*
|
11
|
+
* The above copyright notice and this permission notice shall be
|
12
|
+
* included in all copies or substantial portions of the Software.
|
13
|
+
*
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
18
|
+
* BE LIABLE
|
19
|
+
* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
20
|
+
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
*/
|
23
|
+
|
24
|
+
/* This class is present only for the purpose to be used with the
|
25
|
+
* tests that don't require proper functions to be present, as we
|
26
|
+
* cannot use pointers to void with dynamic_cast.
|
27
|
+
*/
|
28
|
+
class DummyClass {
|
29
|
+
public:
|
30
|
+
DummyClass() { }
|
31
|
+
};
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# Copyright (c) 2007 Diego Pettenò <flameeyes@gmail.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge,
|
7
|
+
# publish, distribute, sublicense, and/or sell copies of the Software,
|
8
|
+
# and to permit persons to whom the Software is furnished to do so,
|
9
|
+
# subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
18
|
+
# BE LIABLE
|
19
|
+
# FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
20
|
+
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
|
23
|
+
require 'test/unit'
|
24
|
+
require 'rbconfig'
|
25
|
+
require 'pathname'
|
26
|
+
require 'tmpdir'
|
27
|
+
|
28
|
+
$: << (Pathname.new(__FILE__).dirname + "../..").realpath
|
29
|
+
|
30
|
+
module Rust
|
31
|
+
|
32
|
+
# The Rust::Test module contains the classes used for Rust regression
|
33
|
+
# testing, both the generic ones, and the actual test ones.
|
34
|
+
module Test
|
35
|
+
# This module is de-facto a subclass of Test::Unit::TestCase, but
|
36
|
+
# because of the way the tests work, so we can't just derive from
|
37
|
+
# that, and instead we use mixins.
|
38
|
+
module ExtensionTest
|
39
|
+
|
40
|
+
def extension_setup(extname, language)
|
41
|
+
raise UnnamedExtension unless extname
|
42
|
+
|
43
|
+
tempdir = Pathname.new(Dir::tmpdir) + "rust-test.#{$$}/#{extname}"
|
44
|
+
tempdir.mkpath
|
45
|
+
|
46
|
+
return if File.exist?("#{tempdir}/#{extname}_rb.so")
|
47
|
+
|
48
|
+
assert( (!File.exist?("#{tempdir}/#{extname}_rb.cc") and !File.exist?("#{tempdir}/#{extname}_rb.hh")),
|
49
|
+
"There are already generated files." )
|
50
|
+
|
51
|
+
puts "Building extension #{extname} (#{language})"
|
52
|
+
|
53
|
+
case language
|
54
|
+
when 'c' then [ 'c', 'h', 'rb' ]
|
55
|
+
when 'cc' then [ 'cc', 'hh', 'rb' ]
|
56
|
+
when 'rb' then [ 'rb' ]
|
57
|
+
end.each do |ext|
|
58
|
+
assert( File.exist?("#{extname}.#{ext}"),
|
59
|
+
"Missing prerequisite #{extname}.#{ext} source file" )
|
60
|
+
end
|
61
|
+
|
62
|
+
sourcedir = Dir.pwd
|
63
|
+
Dir.chdir(tempdir) do
|
64
|
+
load "#{sourcedir}/#{extname}.rb"
|
65
|
+
end
|
66
|
+
|
67
|
+
assert( (File.exists?("#{tempdir}/#{extname}_rb.cc") && File.exist?("#{tempdir}/#{extname}_rb.hh")),
|
68
|
+
"The extension's source files weren't generated.")
|
69
|
+
|
70
|
+
cxx = ENV['CXX'] ? ENV['CXX'] : 'c++'
|
71
|
+
cc = ENV['CC'] ? ENV['CC'] : 'cc'
|
72
|
+
cxxflags = "#{ENV['CXXFLAGS']} -I#{Config::CONFIG["archdir"]} -I. -I../include -DDEBUG -fPIC"
|
73
|
+
cflags = "#{ENV['CFLAGS']} -I. -DDEBUG -fPIC"
|
74
|
+
ldflags = "#{ENV['LDFLAGS']} -Wl,-z,defs -shared"
|
75
|
+
|
76
|
+
cmdlines = []
|
77
|
+
case language
|
78
|
+
when 'cc'
|
79
|
+
sourcefile = "#{extname}.cc"
|
80
|
+
when 'c'
|
81
|
+
sourcefile = "#{tempdir}/#{extname}.o"
|
82
|
+
cmdlines << "#{cc} #{cflags} #{extname}.c -c -o #{tempdir}/#{extname}.o"
|
83
|
+
end
|
84
|
+
|
85
|
+
cmdlines << "#{cxx} #{cxxflags} #{ldflags} #{sourcefile} #{tempdir}/#{extname}_rb.cc -o #{tempdir}/#{extname}_rb.so -lruby"
|
86
|
+
|
87
|
+
cmdlines.each do |cmd|
|
88
|
+
puts cmd
|
89
|
+
ret = system cmd
|
90
|
+
assert ret, "Building of extension #{extname} failed."
|
91
|
+
end
|
92
|
+
|
93
|
+
require "#{tempdir}/#{extname}_rb.so"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Copyright (c) 2007 Diego Pettenò <flameeyes@gmail.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge,
|
7
|
+
# publish, distribute, sublicense, and/or sell copies of the Software,
|
8
|
+
# and to permit persons to whom the Software is furnished to do so,
|
9
|
+
# subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
18
|
+
# BE LIABLE
|
19
|
+
# FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
20
|
+
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
|
23
|
+
require 'lib/extension-test'
|
24
|
+
|
25
|
+
module Rust::Test
|
26
|
+
|
27
|
+
class ConstantsTest < Test::Unit::TestCase
|
28
|
+
include ExtensionTest
|
29
|
+
|
30
|
+
def setup
|
31
|
+
extension_setup("constants", "rb")
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_constants
|
35
|
+
assert(RustTestConstants::DummyClass::ClassConstant == 123,
|
36
|
+
"The class constant is not set properly.")
|
37
|
+
assert(RustTestConstants::ModuleConstant == "foobar",
|
38
|
+
"The module constant is not set properly.")
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# Copyright (c) 2007 Diego Pettenò <flameeyes@gmail.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge,
|
7
|
+
# publish, distribute, sublicense, and/or sell copies of the Software,
|
8
|
+
# and to permit persons to whom the Software is furnished to do so,
|
9
|
+
# subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
18
|
+
# BE LIABLE
|
19
|
+
# FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
20
|
+
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
|
23
|
+
require 'lib/extension-test'
|
24
|
+
|
25
|
+
module Rust::Test
|
26
|
+
|
27
|
+
class CppClassTest < Test::Unit::TestCase
|
28
|
+
include ExtensionTest
|
29
|
+
|
30
|
+
def setup
|
31
|
+
extension_setup("cppclass", "cc")
|
32
|
+
|
33
|
+
@instance = RustTestCppClass::TestClass.new
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_integers
|
37
|
+
@instance.action1 1234
|
38
|
+
assert @instance.integerValue == 1234, "The integer value does not correspond"
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_strings
|
42
|
+
@instance.action2 "a test"
|
43
|
+
assert @instance.stringValue == "a test", "The string value does not correspond"
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_camelcase
|
47
|
+
assert( RustTestCppClass::TestClass.instance_methods.include?("integer_value"),
|
48
|
+
"The converted CamelCase to ruby_convention is missing." )
|
49
|
+
assert( RustTestCppClass::TestClass.instance_method("integer_value") == RustTestCppClass::TestClass.instance_method("integerValue"),
|
50
|
+
"The converted CamelCase to ruby_conversion is not an alias of the original method" )
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_variable
|
55
|
+
random_value = rand(655360)
|
56
|
+
|
57
|
+
@instance.variable = random_value
|
58
|
+
|
59
|
+
assert( @instance.variable == random_value,
|
60
|
+
"The set/get of variable doe snot work." )
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_enum_value
|
64
|
+
assert( RustTestCppClass::TestClass::Foo1 == 0,
|
65
|
+
"Foo1 value is not the expected one." )
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_enum_invalid
|
69
|
+
@instance.test_enum RustTestCppClass::TestClass::Foo1
|
70
|
+
begin
|
71
|
+
@instance.test_enum 4
|
72
|
+
rescue ArgumentError
|
73
|
+
end
|
74
|
+
|
75
|
+
begin
|
76
|
+
@instance.test_enum 255
|
77
|
+
rescue ArgumentError
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# Copyright (c) 2007 Diego Pettenò <flameeyes@gmail.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge,
|
7
|
+
# publish, distribute, sublicense, and/or sell copies of the Software,
|
8
|
+
# and to permit persons to whom the Software is furnished to do so,
|
9
|
+
# subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
18
|
+
# BE LIABLE
|
19
|
+
# FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
20
|
+
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
|
23
|
+
require 'lib/extension-test'
|
24
|
+
|
25
|
+
module Rust::Test
|
26
|
+
|
27
|
+
class CWrapperTest < Test::Unit::TestCase
|
28
|
+
include ExtensionTest
|
29
|
+
|
30
|
+
def setup
|
31
|
+
extension_setup("cwrapper", "c")
|
32
|
+
|
33
|
+
@instance = RustTestCWrapper::TestClass.new
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_constant
|
37
|
+
assert(RustTestCWrapper::TestConstant == 1985,
|
38
|
+
"The test constant is not set properly.")
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_module_function
|
42
|
+
assert(RustTestCWrapper::get_default_integer == 1985,
|
43
|
+
"The module function is not set properly.")
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_get_integer
|
47
|
+
assert(@instance.get_integer == RustTestCWrapper::get_default_integer,
|
48
|
+
"The get_integer function does not work properly")
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_set_integer
|
52
|
+
@instance.set_integer(1987)
|
53
|
+
assert(@instance.get_integer == 1987,
|
54
|
+
"The set_integer function does not work properly")
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_get_string
|
58
|
+
assert(@instance.get_string == "",
|
59
|
+
"The get_string function does not work properly")
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_set_string_valid
|
63
|
+
assert(@instance.set_string("ciao") == true,
|
64
|
+
"The set_string function does not return true for valid values")
|
65
|
+
assert(@instance.get_string == "ciao",
|
66
|
+
"The set_string function does not work properly")
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_set_string_invalid
|
70
|
+
assert(@instance.set_string("foobar" * 70) == false,
|
71
|
+
"The set_string function does not return true for invalid values")
|
72
|
+
assert(@instance.get_string == "",
|
73
|
+
"The set_string function does not ignore invalid values")
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.0
|
3
|
+
specification_version: 1
|
4
|
+
name: gecoder
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.2.0
|
7
|
+
date: 2007-06-19 00:00:00 +02:00
|
8
|
+
summary: Ruby interface to Gecode, an environment for constraint programming.
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: gecoder-devel@rubyforge.org
|
12
|
+
homepage: http://gecoder.rubyforge.org
|
13
|
+
rubyforge_project: gecoder
|
14
|
+
description:
|
15
|
+
autorequire: gecoder
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
29
|
+
authors:
|
30
|
+
- - Gecode/R Development Team
|
31
|
+
files:
|
32
|
+
- Rakefile
|
33
|
+
- README
|
34
|
+
- COPYING
|
35
|
+
- LGPL-LICENSE
|
36
|
+
- lib/gecoder.rb
|
37
|
+
- lib/gecoder/interface.rb
|
38
|
+
- lib/gecoder/bindings.rb
|
39
|
+
- lib/gecoder/interface/search.rb
|
40
|
+
- lib/gecoder/interface/model.rb
|
41
|
+
- lib/gecoder/interface/constraints.rb
|
42
|
+
- lib/gecoder/interface/binding_changes.rb
|
43
|
+
- lib/gecoder/interface/branch.rb
|
44
|
+
- lib/gecoder/interface/enum_wrapper.rb
|
45
|
+
- lib/gecoder/interface/constraints/distinct.rb
|
46
|
+
- lib/gecoder/interface/constraints/relation.rb
|
47
|
+
- lib/gecoder/interface/constraints/linear.rb
|
48
|
+
- lib/gecoder/bindings/bindings.rb
|
49
|
+
- vendor/rust
|
50
|
+
- vendor/rust/test
|
51
|
+
- vendor/rust/include
|
52
|
+
- vendor/rust/bin
|
53
|
+
- vendor/rust/rust
|
54
|
+
- vendor/rust/rust.rb
|
55
|
+
- vendor/rust/README
|
56
|
+
- vendor/rust/test/lib
|
57
|
+
- vendor/rust/test/test-constants.rb
|
58
|
+
- vendor/rust/test/dummyclass.hh
|
59
|
+
- vendor/rust/test/test-cwrapper.rb
|
60
|
+
- vendor/rust/test/cwrapper.c
|
61
|
+
- vendor/rust/test/cwrapper.rb
|
62
|
+
- vendor/rust/test/cppclass.hh
|
63
|
+
- vendor/rust/test/test-cppclass.rb
|
64
|
+
- vendor/rust/test/cwrapper.h
|
65
|
+
- vendor/rust/test/cppclass.rb
|
66
|
+
- vendor/rust/test/cppclass.cc
|
67
|
+
- vendor/rust/test/Makefile
|
68
|
+
- vendor/rust/test/constants.rb
|
69
|
+
- vendor/rust/test/lib/extension-test.rb
|
70
|
+
- vendor/rust/include/rust_conversions.hh
|
71
|
+
- vendor/rust/include/rust_checks.hh
|
72
|
+
- vendor/rust/bin/cxxgenerator.rb
|
73
|
+
- vendor/rust/rust/templates
|
74
|
+
- vendor/rust/rust/bindings.rb
|
75
|
+
- vendor/rust/rust/type.rb
|
76
|
+
- vendor/rust/rust/container.rb
|
77
|
+
- vendor/rust/rust/attribute.rb
|
78
|
+
- vendor/rust/rust/cwrapper.rb
|
79
|
+
- vendor/rust/rust/enum.rb
|
80
|
+
- vendor/rust/rust/class.rb
|
81
|
+
- vendor/rust/rust/function.rb
|
82
|
+
- vendor/rust/rust/cxxclass.rb
|
83
|
+
- vendor/rust/rust/cppifaceparser.rb
|
84
|
+
- vendor/rust/rust/element.rb
|
85
|
+
- vendor/rust/rust/constants.rb
|
86
|
+
- vendor/rust/rust/namespace.rb
|
87
|
+
- vendor/rust/rust/templates/CWrapperClassDefinitions.rusttpl
|
88
|
+
- vendor/rust/rust/templates/FunctionInitBinding.rusttpl
|
89
|
+
- vendor/rust/rust/templates/AttributeDefinition.rusttpl
|
90
|
+
- vendor/rust/rust/templates/BindingsHeader.rusttpl
|
91
|
+
- vendor/rust/rust/templates/CxxStandaloneClassDefinitions.rusttpl
|
92
|
+
- vendor/rust/rust/templates/StandaloneClassDeclarations.rusttpl
|
93
|
+
- vendor/rust/rust/templates/ModuleDeclarations.rusttpl
|
94
|
+
- vendor/rust/rust/templates/ModuleDefinitions.rusttpl
|
95
|
+
- vendor/rust/rust/templates/AttributeInitBinding.rusttpl
|
96
|
+
- vendor/rust/rust/templates/FunctionInitAlias.rusttpl
|
97
|
+
- vendor/rust/rust/templates/ConstructorStub.rusttpl
|
98
|
+
- vendor/rust/rust/templates/CxxClassDefinitions.rusttpl
|
99
|
+
- vendor/rust/rust/templates/ClassInitialize.rusttpl
|
100
|
+
- vendor/rust/rust/templates/VariableFunctionCall.rusttpl
|
101
|
+
- vendor/rust/rust/templates/EnumDeclarations.rusttpl
|
102
|
+
- vendor/rust/rust/templates/EnumDefinitions.rusttpl
|
103
|
+
- vendor/rust/rust/templates/BindingsUnit.rusttpl
|
104
|
+
- vendor/rust/rust/templates/FunctionDefinition.rusttpl
|
105
|
+
- vendor/rust/rust/templates/ClassDeclarations.rusttpl
|
106
|
+
- vendor/rust/rust/templates/MethodInitBinding.rusttpl
|
107
|
+
- vendor/rust/rust/templates/CxxMethodStub.rusttpl
|
108
|
+
- ext/missing.h
|
109
|
+
- ext/extconf.rb
|
110
|
+
- ext/vararray.cpp
|
111
|
+
- ext/missing.cpp
|
112
|
+
- ext/vararray.h
|
113
|
+
test_files: []
|
114
|
+
|
115
|
+
rdoc_options:
|
116
|
+
- --title
|
117
|
+
- Gecode/R
|
118
|
+
- --line-numbers
|
119
|
+
- --inline-source
|
120
|
+
- --main
|
121
|
+
- README
|
122
|
+
extra_rdoc_files:
|
123
|
+
- README
|
124
|
+
- lib/gecoder.rb
|
125
|
+
- lib/gecoder/interface.rb
|
126
|
+
- lib/gecoder/bindings.rb
|
127
|
+
- lib/gecoder/interface/search.rb
|
128
|
+
- lib/gecoder/interface/model.rb
|
129
|
+
- lib/gecoder/interface/constraints.rb
|
130
|
+
- lib/gecoder/interface/binding_changes.rb
|
131
|
+
- lib/gecoder/interface/branch.rb
|
132
|
+
- lib/gecoder/interface/enum_wrapper.rb
|
133
|
+
- lib/gecoder/interface/constraints/distinct.rb
|
134
|
+
- lib/gecoder/interface/constraints/relation.rb
|
135
|
+
- lib/gecoder/interface/constraints/linear.rb
|
136
|
+
- lib/gecoder/bindings/bindings.rb
|
137
|
+
executables: []
|
138
|
+
|
139
|
+
extensions:
|
140
|
+
- ext/extconf.rb
|
141
|
+
requirements: []
|
142
|
+
|
143
|
+
dependencies: []
|
144
|
+
|