{"id":17656726,"url":"https://github.com/burdettelamar/test_values","last_synced_at":"2025-03-30T09:44:41.386Z","repository":{"id":56896975,"uuid":"144576454","full_name":"BurdetteLamar/test_values","owner":"BurdetteLamar","description":null,"archived":false,"fork":false,"pushed_at":"2018-10-21T18:04:15.000Z","size":93,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-06T00:06:49.810Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BurdetteLamar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-13T12:25:54.000Z","updated_at":"2018-10-21T18:04:07.000Z","dependencies_parsed_at":"2022-08-20T17:40:30.836Z","dependency_job_id":null,"html_url":"https://github.com/BurdetteLamar/test_values","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurdetteLamar%2Ftest_values","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurdetteLamar%2Ftest_values/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurdetteLamar%2Ftest_values/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurdetteLamar%2Ftest_values/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BurdetteLamar","download_url":"https://codeload.github.com/BurdetteLamar/test_values/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246301954,"owners_count":20755512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-23T14:35:47.864Z","updated_at":"2025-03-30T09:44:41.335Z","avatar_url":"https://github.com/BurdetteLamar.png","language":"Ruby","readme":"# Test Values\n\n[![Gem](https://img.shields.io/gem/v/test_values.svg?style=flat)](http://rubygems.org/gems/test_values \"View this project in Rubygems\")\n\nThis library makes it easy to generate _and utilize_ certain kinds of values for testing software.\n\n## Named Values\n\nGenerally speaking, a method in this library whose name is plural returns a hash of named values.\n\nThe calling test can iterate over the hash, using the names as labels and the values as test data:\n\n```example.rb```:\n```ruby\nrequire 'minitest/autorun'\n\nrequire 'test_values'\n\nrequire_relative 'my_items'\n\nclass MyTest \u003c Minitest::Test\n\n  def test_bad_item_length\n    items = MyItems.new\n    values  = StringValues.strings_not_in_length_range((4..8))\n    puts \"Testing with values #{values.inspect}\"\n    values.each_pair do |name, value|\n      message = \"Value #{value.inspect} should raise an exception because it is #{name}.\"\n      puts \"\\n#{message}\"\n      e = assert_raises(ArgumentError, message) do\n        items.add_item(value)\n      end\n      puts \"Got exception #{e.inspect}\"\n    end\n\n  end\n\nend\n```\n\n```output.txt```:\n```\nRun options: --seed 9626\n\n# Running:\n\nTesting with values {:too_short=\u003e\"xxx\", :too_long=\u003e\"xxxxxxxxx\"}\n\nValue \"xxx\" should raise an exception because it is too_short.\nGot exception #\u003cArgumentError: xxx\u003e\n\nValue \"xxxxxxxxx\" should raise an exception because it is too_long.\nGot exception #\u003cArgumentError: xxxxxxxxx\u003e\n.\n\nFinished in 0.001457s, 686.1600 runs/s, 1372.3200 assertions/s.\n\n1 runs, 2 assertions, 0 failures, 0 errors, 0 skips\n```\n\n(If you're nosy, you can peek at class [MyItems](https://raw.githubusercontent.com/BurdetteLamar/test_values/master/markdown/readme/named_values/my_items.rb).)\n\n## Classes\n\n- [StringValues](#class-stringvalues)\n- [NumericValues](#class-numericvalues)\n\n### Class ```StringValues```\n\n#### Methods\n\n- [strings_in_length_range](#method-strings_in_length_range)\n- [strings_not_in_length_range](#method-strings_not_in_length_range)\n- [string_of_length](#method-string_of_length)\n- [misspelled](#method-misspelled)\n- [numerics_in_range](#method-numerics_in_range)\n- [numerics_not_in_range](#method-numerics_not_in_range)\n- [booleans](#method-booleans)\n- [not_strings](#method-not_strings)\n- [not_nonempties](#method-not_nonempties)\n- [not_uuids](#method-not_uuids)\n- [not_booleans](#method-not_booleans)\n- [not_ip_addresses](#method-not_ip_addresses)\n- [not_nonnegative_integers](#method-not_nonnegative_integers)\n- [not_positive_integers](#method-not_positive_integers)\n\n#### Method ```strings_in_length_range```\n\n##### Simple\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = StringValues.strings_in_length_range((4..10))\np values\n```\n\n```output.txt```:\n```\n{:min_length=\u003e\"xxxx\", :max_length=\u003e\"xxxxxxxxxx\"}\n```\n\n##### Base String\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = StringValues.strings_in_length_range((4..10), 'abc')\np values\n```\n\n```output.txt```:\n```\n{:min_length=\u003e\"abca\", :max_length=\u003e\"abcabcabca\"}\n```\n\n#### Method ```strings_not_in_length_range```\n\n##### Simple\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = StringValues.strings_not_in_length_range((4..10))\np values\n```\n\n```output.txt```:\n```\n{:too_short=\u003e\"xxx\", :too_long=\u003e\"xxxxxxxxxxx\"}\n```\n\n##### Base String\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = StringValues.strings_not_in_length_range((4..10), 'abc')\np values\n```\n\n```output.txt```:\n```\n{:too_short=\u003e\"abc\", :too_long=\u003e\"abcabcabcab\"}\n```\n\n#### Method ```string_of_length```\n\n##### Simple\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\ns = StringValues.string_of_length(5)\np s\n```\n\n```output.txt```:\n```\n\"xxxxx\"\n```\n\n##### Base String\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\ns = StringValues.string_of_length(5, 'abc')\np s\n```\n\n```output.txt```:\n```\n\"abcab\"\n```\n\n#### Method ```misspelled```\n\n##### Simple\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\ns = StringValues.misspelled('my_string')\np s\n```\n\n```output.txt```:\n```\n\"ny_string\"\n```\n\n##### Special Characters\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\ns = StringValues.misspelled('???What???')\np s\n```\n\n```output.txt```:\n```\n\"???Xhat???\"\n```\n\n#### Method ```numerics_in_range```\n\n##### Integer Range\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = StringValues.numerics_in_range((4..10))\np values\n```\n\n```output.txt```:\n```\n{:min_value=\u003e\"4\", :max_value=\u003e\"10\"}\n```\n\n##### Float Range\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = StringValues.numerics_in_range((4.5..10.5))\np values\n```\n\n```output.txt```:\n```\n{:min_value=\u003e\"4.5\", :max_value=\u003e\"10.5\"}\n```\n\n##### Mixed Range\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = StringValues.numerics_in_range((4..10.5))\np values\n```\n\n```output.txt```:\n```\n{:min_value=\u003e\"4\", :max_value=\u003e\"10.5\"}\n```\n\n#### Method ```numerics_not_in_range```\n\n##### Integer Range\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = StringValues.numerics_not_in_range((4..10))\np values\n```\n\n```output.txt```:\n```\n{:too_small=\u003e\"3\", :too_large=\u003e\"11\"}\n```\n\n##### Float Range\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = StringValues.numerics_not_in_range((4.5..10.5))\np values\n```\n\n```output.txt```:\n```\n{:too_small=\u003e\"4.499999999999999\", :too_large=\u003e\"10.500000000000002\"}\n```\n\n##### Mixed Range\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = StringValues.numerics_not_in_range((4..10.5))\np values\n```\n\n```output.txt```:\n```\n{:too_small=\u003e\"3\", :too_large=\u003e\"10.500000000000002\"}\n```\n\n#### Method ```booleans```\n\n##### Simple\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = StringValues.booleans\np values\n```\n\n```output.txt```:\n```\n{:true=\u003e\"true\", :false=\u003e\"false\"}\n```\n\n#### Method ```not_strings```\n\n##### Simple\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = StringValues.not_strings\np values\n```\n\n```output.txt```:\n```\n{:nil=\u003enil, :not_string=\u003e0}\n```\n\n#### Method ```not_nonempties```\n\n##### Simple\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = StringValues.not_nonempties\np values\n```\n\n```output.txt```:\n```\n{:nil=\u003enil, :not_string=\u003e0, :empty=\u003e\"\"}\n```\n\n#### Method ```not_uuids```\n\n##### Simple\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = StringValues.not_uuids\np values\n```\n\n```output.txt```:\n```\n{:nil=\u003enil, :not_string=\u003e0, :empty=\u003e\"\", :invalid_digits=\u003e\"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"}\n```\n\n#### Method ```not_booleans```\n\n##### Simple\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = StringValues.not_booleans\np values\n```\n\n```output.txt```:\n```\n{:nil=\u003enil, :not_string=\u003e0, :empty=\u003e\"\", :invalid_word=\u003e\"not_boolean\"}\n```\n\n#### Method ```not_ip_addresses```\n\n##### Simple\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = StringValues.not_ip_addresses\np values\n```\n\n```output.txt```:\n```\n{:nil=\u003enil, :not_string=\u003e0, :empty=\u003e\"\", :invalid_digits=\u003e\"xxx.xxx.xxx.xxx\"}\n```\n\n#### Method ```not_nonnegative_integers```\n\n##### Simple\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = StringValues.not_nonnegative_integers\np values\n```\n\n```output.txt```:\n```\n{:nil=\u003enil, :not_string=\u003e0, :empty=\u003e\"\", :negative=\u003e\"-1\"}\n```\n\n#### Method ```not_positive_integers```\n\n##### Simple\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = StringValues.not_positive_integers\np values\n```\n\n```output.txt```:\n```\n{:nil=\u003enil, :not_string=\u003e0, :empty=\u003e\"\", :negative=\u003e\"-1\", :zero=\u003e\"0\"}\n```\n\n\n### Class ```NumericValues```\n\n#### Methods\n\n- [numerics_in_range](#method-numerics_in_range-1)\n- [numerics_not_in_range](#method-numerics_not_in_range-1)\n\n#### Method ```numerics_in_range```\n\n##### Integer Range\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = NumericValues.numerics_in_range((4..10))\np values\n```\n\n```output.txt```:\n```\n{:min_value=\u003e4, :max_value=\u003e10}\n```\n\n##### Float Range\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = NumericValues.numerics_in_range((4.5..10.5))\np values\n```\n\n```output.txt```:\n```\n{:min_value=\u003e4.5, :max_value=\u003e10.5}\n```\n\n##### Mixed Range\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = NumericValues.numerics_in_range((4..10.5))\np values\n```\n\n```output.txt```:\n```\n{:min_value=\u003e4, :max_value=\u003e10.5}\n```\n#### Method ```numerics_not_in_range```\n\n##### Integer Range\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = NumericValues.numerics_not_in_range((4..10))\np values\n```\n\n```output.txt```:\n```\n{:too_small=\u003e3, :too_large=\u003e11}\n```\n\n##### Float Range\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = NumericValues.numerics_not_in_range((4.5..10.5))\np values\n```\n\n```output.txt```:\n```\n{:too_small=\u003e4.499999999999999, :too_large=\u003e10.500000000000002}\n```\n\n##### Mixed Range\n\n```example.rb```:\n```ruby\nrequire 'test_values'\n\nvalues = NumericValues.numerics_not_in_range((4..10.5))\np values\n```\n\n```output.txt```:\n```\n{:too_small=\u003e3, :too_large=\u003e10.500000000000002}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fburdettelamar%2Ftest_values","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fburdettelamar%2Ftest_values","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fburdettelamar%2Ftest_values/lists"}