croupier 0.0.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE.txt +20 -0
- data/README.md +63 -0
- data/RUNNING_TESTS.md +33 -0
- data/Rakefile +9 -0
- data/bin/croupier +26 -0
- data/lib/croupier.rb +61 -0
- data/lib/croupier/cli/application.rb +80 -0
- data/lib/croupier/cli/trollop.rb +791 -0
- data/lib/croupier/distribution.rb +61 -0
- data/lib/croupier/distributions/exponential.rb +39 -0
- data/lib/croupier/distributions/uniform.rb +40 -0
- data/lib/croupier/exceptions.rb +8 -0
- data/test/distributions/R_tests/test_exponential.R +28 -0
- data/test/distributions/R_tests/test_uniform.R +30 -0
- data/test/distributions/generated_samples/exponential_1.data +10000 -0
- data/test/distributions/generated_samples/exponential_1_6.data +10000 -0
- data/test/distributions/generated_samples/uniform_0_1.data +10000 -0
- data/test/distributions/generated_samples/uniform_5_33.data +10000 -0
- data/test/test_croupier_module.rb +15 -0
- data/test/test_distribution_class.rb +28 -0
- data/test/testsuite.R +16 -0
- metadata +37 -18
@@ -0,0 +1,15 @@
|
|
1
|
+
require "croupier"
|
2
|
+
class TestCroupierModule < MiniTest::Unit::TestCase
|
3
|
+
|
4
|
+
def test_module_manages_a_croupier_cli_application_object
|
5
|
+
app = Croupier.application
|
6
|
+
assert_kind_of Croupier::CLI::Application, app
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_accepts_setting_an_external_croupier_cli_application
|
10
|
+
app = Croupier::CLI::Application.new
|
11
|
+
Croupier.application = app
|
12
|
+
assert Croupier.application == app
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "croupier"
|
2
|
+
class TestDistributionClass < MiniTest::Unit::TestCase
|
3
|
+
|
4
|
+
def test_distribution_has_name_and_description
|
5
|
+
dist = Croupier::Distribution.new
|
6
|
+
assert_respond_to dist, 'name'
|
7
|
+
assert_respond_to dist, 'description'
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_distribution_accepts_parameter_configuration
|
11
|
+
dist = Croupier::Distribution.new
|
12
|
+
assert_equal dist.parameters, dist.default_parameters
|
13
|
+
dist.configure({:larry => 'bird', :leonard => 'euler'})
|
14
|
+
refute_equal dist.parameters, dist.default_parameters
|
15
|
+
assert_equal dist.parameters[:larry], 'bird'
|
16
|
+
assert_equal dist.parameters[:leonard], 'euler'
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_distribution_has_trollop_options_info
|
20
|
+
assert_respond_to Croupier::Distribution, 'cli_name'
|
21
|
+
assert_respond_to Croupier::Distribution, 'cli_options'
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_distribution_generates_array_of_n_results
|
25
|
+
assert_equal Croupier::Distribution.new.generate_numbers(15).size, 15
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
data/test/testsuite.R
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env Rscript
|
2
|
+
#
|
3
|
+
# This script runs all the R tests of the croupier gem for all the distributions.
|
4
|
+
# Running the script:
|
5
|
+
# Option 1, Via Rscript:
|
6
|
+
# $> Rscript testsuite.R
|
7
|
+
#
|
8
|
+
# Option 2, from the R console:
|
9
|
+
# source('testsuite.R')
|
10
|
+
#
|
11
|
+
# In order to run the tests you need to have installed the testthat package
|
12
|
+
# If it is not included in your R installation you can do so running this command:
|
13
|
+
# install.packages("testthat", repos = "http://cran.r-project.org/", type="source")
|
14
|
+
#
|
15
|
+
library("testthat")
|
16
|
+
test_dir("./distributions/R_tests/")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: croupier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,28 +9,38 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
13
|
-
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: rspec
|
16
|
-
requirement: &2152836640 !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 2.8.0
|
22
|
-
type: :development
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: *2152836640
|
12
|
+
date: 2012-06-08 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
25
14
|
description: Croupier is a Ruby gem to generate a random sample of numbers with a
|
26
15
|
given probability distribution.
|
27
16
|
email:
|
28
17
|
- jjbazan@gmail.com
|
29
|
-
executables:
|
18
|
+
executables:
|
19
|
+
- croupier
|
30
20
|
extensions: []
|
31
21
|
extra_rdoc_files: []
|
32
22
|
files:
|
23
|
+
- MIT-LICENSE.txt
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- RUNNING_TESTS.md
|
27
|
+
- lib/croupier/cli/application.rb
|
28
|
+
- lib/croupier/cli/trollop.rb
|
29
|
+
- lib/croupier/distribution.rb
|
30
|
+
- lib/croupier/distributions/exponential.rb
|
31
|
+
- lib/croupier/distributions/uniform.rb
|
32
|
+
- lib/croupier/exceptions.rb
|
33
33
|
- lib/croupier.rb
|
34
|
+
- test/distributions/R_tests/test_exponential.R
|
35
|
+
- test/distributions/R_tests/test_uniform.R
|
36
|
+
- test/distributions/generated_samples/exponential_1.data
|
37
|
+
- test/distributions/generated_samples/exponential_1_6.data
|
38
|
+
- test/distributions/generated_samples/uniform_0_1.data
|
39
|
+
- test/distributions/generated_samples/uniform_5_33.data
|
40
|
+
- test/test_croupier_module.rb
|
41
|
+
- test/test_distribution_class.rb
|
42
|
+
- test/testsuite.R
|
43
|
+
- bin/croupier
|
34
44
|
homepage: https://github.com/xuanxu/croupier
|
35
45
|
licenses: []
|
36
46
|
post_install_message:
|
@@ -54,8 +64,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
64
|
version: '0'
|
55
65
|
requirements: []
|
56
66
|
rubyforge_project:
|
57
|
-
rubygems_version: 1.8.
|
67
|
+
rubygems_version: 1.8.15
|
58
68
|
signing_key:
|
59
69
|
specification_version: 3
|
60
|
-
summary: Samples of numbers with specific probability distributions
|
61
|
-
test_files:
|
70
|
+
summary: Samples of random numbers with specific probability distributions
|
71
|
+
test_files:
|
72
|
+
- test/distributions/R_tests/test_exponential.R
|
73
|
+
- test/distributions/R_tests/test_uniform.R
|
74
|
+
- test/distributions/generated_samples/exponential_1.data
|
75
|
+
- test/distributions/generated_samples/exponential_1_6.data
|
76
|
+
- test/distributions/generated_samples/uniform_0_1.data
|
77
|
+
- test/distributions/generated_samples/uniform_5_33.data
|
78
|
+
- test/test_croupier_module.rb
|
79
|
+
- test/test_distribution_class.rb
|
80
|
+
- test/testsuite.R
|