Skip to content

Instantly share code, notes, and snippets.

@abargnesi
Created April 25, 2014 13:16
Show Gist options
  • Save abargnesi/11289193 to your computer and use it in GitHub Desktop.
Save abargnesi/11289193 to your computer and use it in GitHub Desktop.
invalid pointer tests in redlander
#!/usr/bin/env ruby
require 'redlander'
include Redlander
class Node
def self.finalize_node(rdf_node_ptr)
proc {
# XXX Uncommenting the following line seems to invalidate the "rdf_node_ptr". Then the librdf_free_node call always succeeds without error.
#Redland.librdf_node_get_type(rdf_node_ptr)
Redland.librdf_free_node(rdf_node_ptr)
}
end
end
200.times do
subject = Node.new(URI.parse("http://www.example.org/subject"))
predicate = Node.new(URI.parse("http://www.example.org/predicate"))
object = Node.new(URI.parse("http://www.example.org/object"))
Statement.new({
subject: subject,
predicate: predicate,
object: object
})
Statement.new({
subject: Node.new(URI.parse("http://www.example.org/subject")),
predicate: Node.new(URI.parse("http://www.example.org/predicate")),
object: Node.new(URI.parse("http://www.example.org/object"))
})
end
# vim: ts=2 sw=2
@abargnesi
Copy link
Author

Tested on ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment