<commit_before>
# macro test_approx_eq_sigma_eps(A, B, sigma, eps)

include("../docs/example_generation.jl")


# # make and display one plot
# function test_examples(pkg::Symbol, idx::Int; debug = true)
#   Plots._debugMode.on = debug
#   println("Testing plot: $pkg:$idx:$(examples[idx].header)")
#   backend(pkg)
#   backend()
#   map(eval, examples[idx].exprs)
#   plt = current()
#   gui(plt)
#   plt
# end

using Plots, Gtk.ShortNames

function makeImageWidget(fn)
  img = @Image(fn)
  vbox = @Box(:v)
  push!(vbox, img)
  show(img)
  vbox
end

"Show a Gtk popup with both images and a confirmation whether we should replace the new image with the old one"
function isTempImageCorrect(tmpfn, reffn)

  # add the images
  imgbox = @Box(:h)
  push!(imgbox, makeImageWidget(tmpfn))
  push!(imgbox, makeImageWidget(reffn))

  # add the buttons
  keepbtn = @Button("KEEP")
  overwritebtn = @Button("OVERWRITE")
  btnbox = @Box(:h)
  push!(btnbox, keepbtn)
  push!(btnbox, overwritebtn)

  # create the window
  box = @Box(:v)
  push!(box, imgbox)
  push!(box, btnbox)
  w = @Window(@Frame(box))
end


function image_comparison_tests(pkg::Symbol, idx::Int; debug = true)
  <commit_msg>started work on imgcomp tests<commit_after>
# macro test_approx_eq_sigma_eps(A, B, sigma, eps)

include("../docs/example_generation.jl")


# # make and display one plot
# function test_examples(pkg::Symbol, idx::Int; debug = true)
#   Plots._debugMode.on = debug
#   println("Testing plot: $pkg:$idx:$(examples[idx].header)")
#   backend(pkg)
#   backend()
#   map(eval, examples[idx].exprs)
#   plt = current()
#   gui(plt)
#   plt
# end

using Plots, Gtk.ShortNames

function makeImageWidget(fn)
  img = @Image(fn)
  vbox = @Box(:v)
  push!(vbox, img)
  show(img)
  vbox
end

"Show a Gtk popup with both images and a confirmation whether we should replace the new image with the old one"
function isTempImageCorrect(tmpfn, reffn)

  # add the images
  imgbox = @Box(:h)
  push!(imgbox, makeImageWidget(tmpfn))
  push!(imgbox, makeImageWidget(reffn))

  # add the buttons
  keepbtn = @Button("KEEP")
  overwritebtn = @Button("OVERWRITE")
  btnbox = @Box(:h)
  push!(btnbox, keepbtn)
  push!(btnbox, overwritebtn)

  # create the window
  box = @Box(:v)
  push!(box, imgbox)
  push!(box, btnbox)
  w = @Window(@Frame(box))
  showall(w)
  w
end


function image_comparison_tests(pkg::Symbol, idx::Int; debug = true)
  
{'fraction_non_alphanumeric': 0.14244064972927947, 'fraction_numerical': 0.0, 'mean_word_length': 4.446712018140589, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4463284', 'n_tokens_mistral': 903, 'n_tokens_neox': 863, 'n_words': 222}