opt_float_spec.rb 603 B

12345678910111213141516171819202122232425
  1. # -*- coding:binary -*-
  2. require 'spec_helper'
  3. RSpec.describe Msf::OptFloat do
  4. valid_values = [
  5. { :value => "1", :normalized => 1.0 },
  6. { :value => "1.1", :normalized => 1.1 },
  7. { :value => "0", :normalized => 0.0 },
  8. { :value => "-1", :normalized => -1.0 },
  9. { :value => "01", :normalized => 1.0 },
  10. { :value => "0xff", :normalized => 255.0 },
  11. ]
  12. invalid_values = [
  13. { :value => "0xblah", },
  14. { :value => "-12cat", },
  15. { :value => "covfefe", },
  16. { :value => "NaN", },
  17. ]
  18. it_behaves_like "an option", valid_values, invalid_values, 'float'
  19. end