<commit_before>using PETSc
using FactCheck

# determine scalar type of current run
global ST = Float64  # scalar type

function RC(x::Number)
# used to test real, complex
  if ST == Float64
    return Float64(real(x))
  elseif ST == Float32
    return Float32(real(x))
  else  # scalar_type == 3
    return complex(x)
  end
end

function RC(x::AbstractArray)
# used to test real, complex
  if ST == Float64
    tmp = similar(x, ST)
    for i=1:length(x)
      tmp[i] = Float64(real(x[i]))
    end
    return tmp
  elseif ST == Float32
    tmp = similar(x, ST)
    for i=1:length(x)
      tmp[i] = ST(real(x[i]))
    end
    return tmp
  else  # scalar_type == 3
    return x
  end
end

for ST in PETSc.C.petsc_type
  println("\n\nTesting ", ST)
  include("error.jl")
  include("vec.jl")
  include("mat.jl")
  include("ksp.jl")
  include("is.jl")
end

facts("\ntesting options") do
    OPTIONS["foo"]=true
    for ST in PETSc.C.petsc_type
        @fact haskey(OPTIONS[ST], :foo) --> true
        @fact OPTIONS[ST][:foo] --> "true"
    end
    OPTIONS["foo"]=nothing
    for ST in PETSc.C.petsc_type
        @fact haskey(OPTIONS[ST], :foo) --> false
        OPTIONS[ST]["bar"] = 17
        @fact pop!(OPTIONS[ST], "bar") --> "17"
        @fact pop!(OPTIONS[ST], "bar", 23) --> 23
        @fact haskey(OPTIONS[ST], :bar) --> false
        withoptions(ST, "baz"=>"aloha") do
            @fact OPTIONS[ST][:baz] --> "aloha"
        end
        @fact haskey(OPTIONS[ST], :baz) --> false
    end
end<commit_msg>have travis actually fail on test errors<commit_after>using PETSc
using FactCheck

# determine scalar type of current run
global ST = Float64  # scalar type

function RC(x::Number)
# used to test real, complex
  if ST == Float64
    return Float64(real(x))
  elseif ST == Float32
    return Float32(real(x))
  else  # scalar_type == 3
    return complex(x)
  end
end

function RC(x::AbstractArray)
# used to test real, complex
  if ST == Float64
    tmp = similar(x, ST)
    for i=1:length(x)
      tmp[i] = Float64(real(x[i]))
    end
    return tmp
  elseif ST == Float32
    tmp = similar(x, ST)
    for i=1:length(x)
      tmp[i] = ST(real(x[i]))
    end
    return tmp
  else  # scalar_type == 3
    return x
  end
end

for ST in PETSc.C.petsc_type
  println("\n\nTesting ", ST)
  include("error.jl")
  include("vec.jl")
  include("mat.jl")
  include("ksp.jl")
  include("is.jl")
end

facts("\ntesting options") do
    OPTIONS["foo"]=true
    for ST in PETSc.C.petsc_type
        @fact haskey(OPTIONS[ST], :foo) --> true
        @fact OPTIONS[ST][:foo] --> "true"
    end
    OPTIONS["foo"]=nothing
    for ST in PETSc.C.petsc_type
        @fact haskey(OPTIONS[ST], :foo) --> false
        OPTIONS[ST]["bar"] = 17
        @fact pop!(OPTIONS[ST], "bar") --> "17"
        @fact pop!(OPTIONS[ST], "bar", 23) --> 23
        @fact haskey(OPTIONS[ST], :bar) --> false
        withoptions(ST, "baz"=>"aloha") do
            @fact OPTIONS[ST][:baz] --> "aloha"
        end
        @fact haskey(OPTIONS[ST], :baz) --> false
    end
end

exitstatus()
{'fraction_non_alphanumeric': 0.1541489012791079, 'fraction_numerical': 0.018366677599212858, 'mean_word_length': 2.6614645858343335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '1600010', 'n_tokens_mistral': 1183, 'n_tokens_neox': 1104, 'n_words': 294}