stream_sampler 0.0.1 → 0.0.2

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.
@@ -22,6 +22,18 @@ class StreamSamplerTest < ActiveSupport::TestCase
22
22
  result = StreamSampler.reservoir_sample(items, 10)
23
23
  assert_equal 10, result.length
24
24
  end
25
+
26
+ test "reservoir_sample selects correctly from a two-element set" do
27
+ seen = []
28
+
29
+ 100.times do |i|
30
+ result = StreamSampler.reservoir_sample([1,2], 1)
31
+ seen << result
32
+ break if seen.length == 2
33
+ end
34
+
35
+ assert_equal 2, seen.length
36
+ end
25
37
  end
26
38
 
27
39
  class ActsAsSamplableTest < ActiveSupport::TestCase
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stream_sampler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Robertson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-05 00:00:00.000000000 Z
11
+ date: 2015-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -97,11 +97,9 @@ files:
97
97
  - test/dummy/config/locales/en.yml
98
98
  - test/dummy/config/routes.rb
99
99
  - test/dummy/config/secrets.yml
100
- - test/dummy/db/development.sqlite3
101
100
  - test/dummy/db/migrate/20150305003414_create_users.rb
102
101
  - test/dummy/db/schema.rb
103
102
  - test/dummy/db/test.sqlite3
104
- - test/dummy/log/development.log
105
103
  - test/dummy/log/test.log
106
104
  - test/dummy/public/404.html
107
105
  - test/dummy/public/422.html
@@ -110,7 +108,6 @@ files:
110
108
  - test/dummy/test/fixtures/users.yml
111
109
  - test/dummy/test/models/user_test.rb
112
110
  - test/stream_sampler_test.rb
113
- - test/stream_sampler_test.rb~
114
111
  - test/test_helper.rb
115
112
  homepage: https://www.omniref.com/ruby/gems/stream_sampler
116
113
  licenses:
@@ -166,11 +163,9 @@ test_files:
166
163
  - test/dummy/config/routes.rb
167
164
  - test/dummy/config/secrets.yml
168
165
  - test/dummy/config.ru
169
- - test/dummy/db/development.sqlite3
170
166
  - test/dummy/db/migrate/20150305003414_create_users.rb
171
167
  - test/dummy/db/schema.rb
172
168
  - test/dummy/db/test.sqlite3
173
- - test/dummy/log/development.log
174
169
  - test/dummy/log/test.log
175
170
  - test/dummy/public/404.html
176
171
  - test/dummy/public/422.html
@@ -181,6 +176,4 @@ test_files:
181
176
  - test/dummy/test/fixtures/users.yml
182
177
  - test/dummy/test/models/user_test.rb
183
178
  - test/stream_sampler_test.rb
184
- - test/stream_sampler_test.rb~
185
179
  - test/test_helper.rb
186
- has_rdoc:
Binary file
@@ -1,25 +0,0 @@
1
-  (2.7ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
2
-  (0.8ms) select sqlite_version(*)
3
-  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
5
- Migrating to CreateUsers (20150305003316)
6
-  (0.0ms) begin transaction
7
-  (0.2ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
8
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150305003316"]]
9
-  (0.8ms) commit transaction
10
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
11
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
12
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
13
- Migrating to CreateUsers (20150305003316)
14
-  (0.0ms) begin transaction
15
-  (0.6ms) DROP TABLE "users"
16
- SQL (0.1ms) DELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = ? [["version", "20150305003316"]]
17
-  (0.6ms) commit transaction
18
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
19
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
20
- Migrating to CreateUsers (20150305003414)
21
-  (0.0ms) begin transaction
22
-  (0.3ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
23
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150305003414"]]
24
-  (2.0ms) commit transaction
25
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
@@ -1,6 +0,0 @@
1
- require 'test_helper'
2
-
3
- class StreamSamplerTest < ActiveSupport::TestCase
4
- test "stream_sample is a scope" do
5
- end
6
- end