From 5b631ecd90026cbe805edee92afbabc32268e54a Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Thu, 19 Mar 2015 00:23:35 -0700 Subject: [PATCH] Use Compat, test both nightly and release on Travis --- .travis.yml | 22 +++++++++++----------- REQUIRE | 1 + src/bloom-filter.jl | 6 ++++-- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index ba6660b..22bc835 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,13 @@ -language: cpp -compiler: - - clang +language: julia +os: + - linux + - osx +julia: + - release + - nightly notifications: email: false -before_install: - - sudo add-apt-repository ppa:staticfloat/julia-deps -y - - sudo add-apt-repository ppa:staticfloat/julianightlies -y - - sudo apt-get update -qq -y - - sudo apt-get install libpcre3-dev julia -y -script: - - julia -e 'Pkg.init(); run(`ln -s $(pwd()) $(Pkg.dir("BloomFilters"))`); Pkg.pin("BloomFilters"); Pkg.resolve()' - - julia -e 'using BloomFilters; @assert isdefined(:BloomFilters); @assert typeof(BloomFilters) === Module; include(joinpath(Pkg.dir("BloomFilters"), "test/runtests.jl"))' +# uncomment the following lines to override the default test script +#script: +# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi +# - julia --check-bounds=yes -e 'Pkg.clone(pwd()); Pkg.build("BloomFilters"); Pkg.test("BloomFilters"; coverage=true)' diff --git a/REQUIRE b/REQUIRE index ea6bb38..a47851c 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1 +1,2 @@ julia 0.3.1- +Compat diff --git a/src/bloom-filter.jl b/src/bloom-filter.jl index 39ea0c3..a208511 100644 --- a/src/bloom-filter.jl +++ b/src/bloom-filter.jl @@ -1,3 +1,5 @@ +using Compat + include("probabilities.jl") type BloomFilter @@ -15,8 +17,8 @@ end # which uses 2 hash functions vs. k and has comparable properties # See Kirsch and Mitzenmacher, 2008: http://www.eecs.harvard.edu/~kirsch/pubs/bbbf/rsa.pdf function hash_n(key::Any, k::Int, max::Int) - a_hash = hash(key, UInt(0)) - b_hash = hash(key, UInt(170)) + a_hash = hash(key, @compat UInt(0)) + b_hash = hash(key, @compat UInt(170)) hashes = Array(Uint, k) for i in 1:k hashes[i] = mod(a_hash + i * b_hash, max) + 1