prompt stringlengths 5.33k 21.1k | metadata dict | context_start_lineno int64 1 913 | line_no int64 16 984 | repo stringclasses 5
values | id int64 0 416 | target_function_prompt stringlengths 201 13.6k | function_signature stringlengths 7 453 | solution_position listlengths 2 2 | raw_solution stringlengths 201 13.6k |
|---|---|---|---|---|---|---|---|---|---|
Your task is to generate only the test code for the given focal function in Julia programming language.
Instructions:
- Use the Test module with idiomatic @testset and @test macros.
- (IMPORTANT) Always refer to the focal function using the module_name.function_name format — even if it is exported.
- Do NOT rewrite or... | {
"fpath_tuple": [
"DataStructures.jl",
"src",
"accumulator.jl"
],
"ground_truth": "function Base.intersect!(a::Accumulator, b::Accumulator)\n for k in union(keys(a), keys(b)) # union not intersection as we want to check both multiplicities\n va = a[k]\n vb = b[k]\n va >= 0 || ... | 230 | 241 | DataStructures.jl | 0 | function Base.intersect!(a::Accumulator, b::Accumulator)
for k in union(keys(a), keys(b)) # union not intersection as we want to check both multiplicities
va = a[k]
vb = b[k]
va >= 0 || throw(MultiplicityException(k, va))
vb >= 0 || throw(MultiplicityException(k, vb))
a[k] =... | Base.intersect!(a::Accumulator, b::Accumulator) | [
230,
241
] | function Base.intersect!(a::Accumulator, b::Accumulator)
for k in union(keys(a), keys(b)) # union not intersection as we want to check both multiplicities
va = a[k]
vb = b[k]
va >= 0 || throw(MultiplicityException(k, va))
vb >= 0 || throw(MultiplicityException(k, vb))
a[k] =... |
Your task is to generate only the test code for the given focal function in Julia programming language.
Instructions:
- Use the Test module with idiomatic @testset and @test macros.
- (IMPORTANT) Always refer to the focal function using the module_name.function_name format — even if it is exported.
- Do NOT rewrite or... | {
"fpath_tuple": [
"DataStructures.jl",
"src",
"avl_tree.jl"
],
"ground_truth": "function left_rotate(z::AVLTreeNode)\n y = z.rightChild\n α = y.leftChild\n y.leftChild = z\n z.rightChild = α\n z.height = compute_height(z)\n y.height = compute_height(y)\n z.subsize = compute_subtr... | 83 | 93 | DataStructures.jl | 1 | function left_rotate(z::AVLTreeNode)
y = z.rightChild
α = y.leftChild
y.leftChild = z
z.rightChild = α
z.height = compute_height(z)
y.height = compute_height(y)
z.subsize = compute_subtree_size(z)
y.subsize = compute_subtree_size(y)
return y
end | left_rotate(z::AVLTreeNode) | [
83,
93
] | function left_rotate(z::AVLTreeNode)
y = z.rightChild
α = y.leftChild
y.leftChild = z
z.rightChild = α
z.height = compute_height(z)
y.height = compute_height(y)
z.subsize = compute_subtree_size(z)
y.subsize = compute_subtree_size(y)
return y
end |
Your task is to generate only the test code for the given focal function in Julia programming language.
Instructions:
- Use the Test module with idiomatic @testset and @test macros.
- (IMPORTANT) Always refer to the focal function using the module_name.function_name format — even if it is exported.
- Do NOT rewrite or... | {
"fpath_tuple": [
"DataStructures.jl",
"src",
"avl_tree.jl"
],
"ground_truth": "function right_rotate(z::AVLTreeNode)\n y = z.leftChild\n α = y.rightChild\n y.rightChild = z\n z.leftChild = α\n z.height = compute_height(z)\n y.height = compute_height(y)\n z.subsize = compute_subt... | 100 | 110 | DataStructures.jl | 2 | function right_rotate(z::AVLTreeNode)
y = z.leftChild
α = y.rightChild
y.rightChild = z
z.leftChild = α
z.height = compute_height(z)
y.height = compute_height(y)
z.subsize = compute_subtree_size(z)
y.subsize = compute_subtree_size(y)
return y
end | right_rotate(z::AVLTreeNode) | [
100,
110
] | function right_rotate(z::AVLTreeNode)
y = z.leftChild
α = y.rightChild
y.rightChild = z
z.leftChild = α
z.height = compute_height(z)
y.height = compute_height(y)
z.subsize = compute_subtree_size(z)
y.subsize = compute_subtree_size(y)
return y
end |
Your task is to generate only the test code for the given focal function in Julia programming language.
Instructions:
- Use the Test module with idiomatic @testset and @test macros.
- (IMPORTANT) Always refer to the focal function using the module_name.function_name format — even if it is exported.
- Do NOT rewrite or... | {
"fpath_tuple": [
"DataStructures.jl",
"src",
"avl_tree.jl"
],
"ground_truth": "function search_node(tree::AVLTree{K}, d::K) where K\n prev = nothing\n node = tree.root\n while node != nothing && node.data != nothing && node.data != d\n\n prev = node\n if d < node.data\n ... | 124 | 138 | DataStructures.jl | 3 | function search_node(tree::AVLTree{K}, d::K) where K
prev = nothing
node = tree.root
while node != nothing && node.data != nothing && node.data != d
prev = node
if d < node.data
node = node.leftChild
else
node = node.rightChild
end
end
return... | search_node(tree::AVLTree{K}, d::K) where K | [
124,
138
] | function search_node(tree::AVLTree{K}, d::K) where K
prev = nothing
node = tree.root
while node != nothing && node.data != nothing && node.data != d
prev = node
if d < node.data
node = node.leftChild
else
node = node.rightChild
end
end
return... |
Your task is to generate only the test code for the given focal function in Julia programming language.
Instructions:
- Use the Test module with idiomatic @testset and @test macros.
- (IMPORTANT) Always refer to the focal function using the module_name.function_name format — even if it is exported.
- Do NOT rewrite or... | {
"fpath_tuple": [
"DataStructures.jl",
"src",
"avl_tree.jl"
],
"ground_truth": "function insert_node(node::AVLTreeNode{K}, key::K) where K\n if key < node.data\n node.leftChild = insert_node(node.leftChild, key)\n else\n node.rightChild = insert_node(node.rightChild, key)\n end... | 162 | 192 | DataStructures.jl | 4 | function insert_node(node::AVLTreeNode{K}, key::K) where K
if key < node.data
node.leftChild = insert_node(node.leftChild, key)
else
node.rightChild = insert_node(node.rightChild, key)
end
node.subsize = compute_subtree_size(node)
node.height = compute_height(node)
balance = get... | insert_node(node::AVLTreeNode{K}, key::K) where K | [
162,
192
] | function insert_node(node::AVLTreeNode{K}, key::K) where K
if key < node.data
node.leftChild = insert_node(node.leftChild, key)
else
node.rightChild = insert_node(node.rightChild, key)
end
node.subsize = compute_subtree_size(node)
node.height = compute_height(node)
balance = get... |
Your task is to generate only the test code for the given focal function in Julia programming language.
Instructions:
- Use the Test module with idiomatic @testset and @test macros.
- (IMPORTANT) Always refer to the focal function using the module_name.function_name format — even if it is exported.
- Do NOT rewrite or... | {
"fpath_tuple": [
"DataStructures.jl",
"src",
"avl_tree.jl"
],
"ground_truth": "function delete_node!(node::AVLTreeNode{K}, key::K) where K\n if key < node.data\n node.leftChild = delete_node!(node.leftChild, key)\n elseif key > node.data\n node.rightChild = delete_node!(node.righ... | 212 | 254 | DataStructures.jl | 5 | function delete_node!(node::AVLTreeNode{K}, key::K) where K
if key < node.data
node.leftChild = delete_node!(node.leftChild, key)
elseif key > node.data
node.rightChild = delete_node!(node.rightChild, key)
else
if node.leftChild == nothing
result = node.rightChild
... | delete_node!(node::AVLTreeNode{K}, key::K) where K | [
212,
254
] | function delete_node!(node::AVLTreeNode{K}, key::K) where K
if key < node.data
node.leftChild = delete_node!(node.leftChild, key)
elseif key > node.data
node.rightChild = delete_node!(node.rightChild, key)
else
if node.leftChild == nothing
result = node.rightChild
... |
Your task is to generate only the test code for the given focal function in Julia programming language.
Instructions:
- Use the Test module with idiomatic @testset and @test macros.
- (IMPORTANT) Always refer to the focal function using the module_name.function_name format — even if it is exported.
- Do NOT rewrite or... | {
"fpath_tuple": [
"DataStructures.jl",
"src",
"avl_tree.jl"
],
"ground_truth": "function sorted_rank(tree::AVLTree{K}, key::K) where K\n !haskey(tree, key) && throw(KeyError(key))\n node = tree.root\n rank = 0\n while node.data != key\n if (node.data < key)\n rank += (1 ... | 290 | 304 | DataStructures.jl | 6 | function sorted_rank(tree::AVLTree{K}, key::K) where K
!haskey(tree, key) && throw(KeyError(key))
node = tree.root
rank = 0
while node.data != key
if (node.data < key)
rank += (1 + get_subsize(node.leftChild))
node = node.rightChild
else
node = node.le... | sorted_rank(tree::AVLTree{K}, key::K) where K | [
290,
304
] | function sorted_rank(tree::AVLTree{K}, key::K) where K
!haskey(tree, key) && throw(KeyError(key))
node = tree.root
rank = 0
while node.data != key
if (node.data < key)
rank += (1 + get_subsize(node.leftChild))
node = node.rightChild
else
node = node.le... |
Your task is to generate only the test code for the given focal function in Julia programming language.
Instructions:
- Use the Test module with idiomatic @testset and @test macros.
- (IMPORTANT) Always refer to the focal function using the module_name.function_name format — even if it is exported.
- Do NOT rewrite or... | {
"fpath_tuple": [
"DataStructures.jl",
"src",
"avl_tree.jl"
],
"ground_truth": "function Base.getindex(tree::AVLTree{K}, ind::Integer) where K\n @boundscheck (1 <= ind <= tree.count) || throw(BoundsError(\"$ind should be in between 1 and $(tree.count)\"))\n function traverse_tree(node::AVLTreeN... | 329 | 345 | DataStructures.jl | 7 | function Base.getindex(tree::AVLTree{K}, ind::Integer) where K
@boundscheck (1 <= ind <= tree.count) || throw(BoundsError("$ind should be in between 1 and $(tree.count)"))
function traverse_tree(node::AVLTreeNode_or_null, idx)
if (node != nothing)
L = get_subsize(node.leftChild)
... | Base.getindex(tree::AVLTree{K}, ind::Integer) where K | [
329,
345
] | function Base.getindex(tree::AVLTree{K}, ind::Integer) where K
@boundscheck (1 <= ind <= tree.count) || throw(BoundsError("$ind should be in between 1 and $(tree.count)"))
function traverse_tree(node::AVLTreeNode_or_null, idx)
if (node != nothing)
L = get_subsize(node.leftChild)
... |
Your task is to generate only the test code for the given focal function in Julia programming language.
Instructions:
- Use the Test module with idiomatic @testset and @test macros.
- (IMPORTANT) Always refer to the focal function using the module_name.function_name format — even if it is exported.
- Do NOT rewrite or... | {
"fpath_tuple": [
"DataStructures.jl",
"src",
"balanced_tree.jl"
],
"ground_truth": "function Base.empty!(t::BalancedTree23)\n resize!(t.data,2)\n initializeData!(t.data)\n resize!(t.tree,1)\n initializeTree!(t.tree)\n t.depth = 1\n t.rootloc = 1\n empty!(t.freetreeinds)\n emp... | 238 | 250 | DataStructures.jl | 8 | function Base.empty!(t::BalancedTree23)
resize!(t.data,2)
initializeData!(t.data)
resize!(t.tree,1)
initializeTree!(t.tree)
t.depth = 1
t.rootloc = 1
empty!(t.freetreeinds)
empty!(t.freedatainds)
empty!(t.useddatacells)
push!(t.useddatacells, 1, 2)
return nothing
end | Base.empty!(t::BalancedTree23) | [
238,
250
] | function Base.empty!(t::BalancedTree23)
resize!(t.data,2)
initializeData!(t.data)
resize!(t.tree,1)
initializeTree!(t.tree)
t.depth = 1
t.rootloc = 1
empty!(t.freetreeinds)
empty!(t.freedatainds)
empty!(t.useddatacells)
push!(t.useddatacells, 1, 2)
return nothing
end |
Your task is to generate only the test code for the given focal function in Julia programming language.
Instructions:
- Use the Test module with idiomatic @testset and @test macros.
- (IMPORTANT) Always refer to the focal function using the module_name.function_name format — even if it is exported.
- Do NOT rewrite or... | {
"fpath_tuple": [
"DataStructures.jl",
"src",
"balanced_tree.jl"
],
"ground_truth": "function findkeyless(t::BalancedTree23, k)\n curnode = t.rootloc\n for depthcount = 1 : t.depth - 1\n @inbounds thisnode = t.tree[curnode]\n cmp = thisnode.child3 == 0 ?\n cmp2le_non... | 292 | 309 | DataStructures.jl | 9 | function findkeyless(t::BalancedTree23, k)
curnode = t.rootloc
for depthcount = 1 : t.depth - 1
@inbounds thisnode = t.tree[curnode]
cmp = thisnode.child3 == 0 ?
cmp2le_nonleaf(t.ord, thisnode, k) :
cmp3le_nonleaf(t.ord, thisnode, k)
curnode = cmp == 1 ? thi... | findkeyless(t::BalancedTree23, k) | [
292,
309
] | function findkeyless(t::BalancedTree23, k)
curnode = t.rootloc
for depthcount = 1 : t.depth - 1
@inbounds thisnode = t.tree[curnode]
cmp = thisnode.child3 == 0 ?
cmp2le_nonleaf(t.ord, thisnode, k) :
cmp3le_nonleaf(t.ord, thisnode, k)
curnode = cmp == 1 ? thi... |
Your task is to generate only the test code for the given focal function in Julia programming language.
Instructions:
- Use the Test module with idiomatic @testset and @test macros.
- (IMPORTANT) Always refer to the focal function using the module_name.function_name format — even if it is exported.
- Do NOT rewrite or... | {
"fpath_tuple": [
"DataStructures.jl",
"src",
"balanced_tree.jl"
],
"ground_truth": "function Base.insert!(t::BalancedTree23{K,D,Ord}, k, d, allowdups::Bool) where {K,D,Ord <: Ordering}\n\n ## First we find the greatest data node that is <= k.\n leafind, exactfound = findkey(t, k)\n parent =... | 358 | 520 | DataStructures.jl | 10 | function Base.insert!(t::BalancedTree23{K,D,Ord}, k, d, allowdups::Bool) where {K,D,Ord <: Ordering}
## First we find the greatest data node that is <= k.
leafind, exactfound = findkey(t, k)
parent = t.data[leafind].parent
## The following code is necessary because in the case of a
## brand new tr... | Base.insert!(t::BalancedTree23{K,D,Ord}, k, d, allowdups::Bool) where {K,D,Ord <: Ordering} | [
358,
520
] | function Base.insert!(t::BalancedTree23{K,D,Ord}, k, d, allowdups::Bool) where {K,D,Ord <: Ordering}
## First we find the greatest data node that is <= k.
leafind, exactfound = findkey(t, k)
parent = t.data[leafind].parent
## The following code is necessary because in the case of a
## brand new tr... |
Your task is to generate only the test code for the given focal function in Julia programming language.
Instructions:
- Use the Test module with idiomatic @testset and @test macros.
- (IMPORTANT) Always refer to the focal function using the module_name.function_name format — even if it is exported.
- Do NOT rewrite or... | {
"fpath_tuple": [
"DataStructures.jl",
"src",
"balanced_tree.jl"
],
"ground_truth": "function Base.delete!(t::BalancedTree23{K,D,Ord}, it::Int) where {K,D,Ord<:Ordering}\n\n ## Put the cell indexed by 'it' into the deletion list.\n ##\n ## Create the following data items maintained in the\n ... | 655 | 984 | DataStructures.jl | 11 | function Base.delete!(t::BalancedTree23{K,D,Ord}, it::Int) where {K,D,Ord<:Ordering}
## Put the cell indexed by 'it' into the deletion list.
##
## Create the following data items maintained in the
## upcoming loop.
##
## p is a tree-node ancestor of the deleted node
## The children of p are... | Base.delete!(t::BalancedTree23{K,D,Ord}, it::Int) where {K,D,Ord<:Ordering} | [
655,
984
] | function Base.delete!(t::BalancedTree23{K,D,Ord}, it::Int) where {K,D,Ord<:Ordering}
## Put the cell indexed by 'it' into the deletion list.
##
## Create the following data items maintained in the
## upcoming loop.
##
## p is a tree-node ancestor of the deleted node
## The children of p are... |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 3