Sha256: 175da1dfd4679110e4332144d3639d7591e68c339b029d9491cdfb81b3cfddb0

Contents?: true

Size: 1.9 KB

Versions: 20

Compression:

Stored size: 1.9 KB

Contents

require "test/unit"
require "mkmf-cu/opt"
require "mkmf-cu"

class TestMkmfCuOpt < Test::Unit::TestCase

  def setup
    @opt, @opt_h = build_optparser()
  end

  def test_opt
    argv = ["-pipe", "-Os", "-x", "cu", "-O2", "-Wall", "-arch", "x86_64"]
    parse_ill_short(argv, @opt_h)
    assert_equal(["-Os", "-x", "cu", "-O2", "-Wall", "--arch", "x86_64"],
                 argv)
  end

  def test_Gg
    argv = ["-g", "-G"]
    parse_ill_short(argv, @opt_h)
    @opt.parse(argv)
    assert_equal({"-g" => [""], "-G" => [""]}, @opt_h)
  end

  def test_compiler_option
    @opt_h.merge!({"-shared"=>[""], "-pipe"=>[""]})
    assert_equal(" --compiler-options -pipe", compiler_option(@opt_h))
  end

  def test_Wl
    argv = ["-Wl,-headerpad_max_install_names", "-fstack-protector", "-L/opt/local/lib",
            "-Wl,-undefined,dynamic_lookup", "-Wl,-multiply_defined,suppress"]
    parse_ill_short_with_arg(argv, @opt_h)
    assert_equal(["--Wl=-headerpad_max_install_names", "-fstack-protector", "-L/opt/local/lib",
                  "--Wl=-undefined,dynamic_lookup", "--Wl=-multiply_defined,suppress"],
                 argv)
  end

  def test_linker_option
    @opt_h.merge!({"-Wl"=>["-a", "-b"]})
    assert_equal(" --linker-options -a --linker-options -b",
                 linker_option(@opt_h))
  end

  def test_std
    argv = ["-std=c++11"]
    parse_ill_short_with_arg(argv, @opt_h)
    @opt.parse(argv)
    assert_equal({"-std" => ["c++11"]}, @opt_h)
  end

  def test_compiler_bin
    h = Hash.new{|h, k| h[k] = [] }.merge({"-shared"=>[""], "-pipe"=>[""], "--mkmf-cu-ext"=>["c"]})
    assert_equal(" --compiler-bindir " + RbConfig::CONFIG["CC"],
                 compiler_bin(h))
  end

  def test_mkmf_cu
    assert MakeMakefile::C_EXT.include?("cu")
    assert MakeMakefile::SRC_EXT.include?("cu")

    treat_cu_as_cxx()
    assert !MakeMakefile::C_EXT.include?("cu")
    assert MakeMakefile::CXX_EXT.include?("cu")
  end

end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
cumo-0.4.3 3rd_party/mkmf-cu/test/test_mkmf-cu.rb
cumo-0.4.2 3rd_party/mkmf-cu/test/test_mkmf-cu.rb
cumo-0.4.1 3rd_party/mkmf-cu/test/test_mkmf-cu.rb
cumo-0.4.0 3rd_party/mkmf-cu/test/test_mkmf-cu.rb
cumo-0.3.5 3rd_party/mkmf-cu/test/test_mkmf-cu.rb
cumo-0.3.4 3rd_party/mkmf-cu/test/test_mkmf-cu.rb
cumo-0.3.3 3rd_party/mkmf-cu/test/test_mkmf-cu.rb
cumo-0.3.2 3rd_party/mkmf-cu/test/test_mkmf-cu.rb
cumo-0.3.1 3rd_party/mkmf-cu/test/test_mkmf-cu.rb
cumo-0.3.0 3rd_party/mkmf-cu/test/test_mkmf-cu.rb
cumo-0.3.0.pre1 3rd_party/mkmf-cu/test/test_mkmf-cu.rb
cumo-0.2.5 3rd_party/mkmf-cu/test/test_mkmf-cu.rb
cumo-0.2.4 3rd_party/mkmf-cu/test/test_mkmf-cu.rb
cumo-0.2.3 3rd_party/mkmf-cu/test/test_mkmf-cu.rb
cumo-0.2.2 3rd_party/mkmf-cu/test/test_mkmf-cu.rb
cumo-0.2.1 3rd_party/mkmf-cu/test/test_mkmf-cu.rb
cumo-0.2.0 3rd_party/mkmf-cu/test/test_mkmf-cu.rb
cumo-0.1.2 3rd_party/mkmf-cu/test/test_mkmf-cu.rb
cumo-0.1.1 3rd_party/mkmf-cu/test/test_mkmf-cu.rb
cumo-0.1.0 3rd_party/mkmf-cu/test/test_mkmf-cu.rb