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.
- checksums.yaml +4 -4
- data/lib/stream_sampler.rb +1 -1
- data/lib/stream_sampler/version.rb +1 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +1145 -1686
- data/test/stream_sampler_test.rb +12 -0
- metadata +2 -9
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/log/development.log +0 -25
- data/test/stream_sampler_test.rb~ +0 -6
data/test/stream_sampler_test.rb
CHANGED
|
@@ -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.
|
|
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-
|
|
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
|
-
[1m[36m (2.7ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
|
2
|
-
[1m[35m (0.8ms)[0m select sqlite_version(*)
|
|
3
|
-
[1m[36m (0.9ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
|
4
|
-
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
|
5
|
-
Migrating to CreateUsers (20150305003316)
|
|
6
|
-
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
|
7
|
-
[1m[35m (0.2ms)[0m CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
|
8
|
-
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20150305003316"]]
|
|
9
|
-
[1m[35m (0.8ms)[0m commit transaction
|
|
10
|
-
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
11
|
-
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
12
|
-
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
|
13
|
-
Migrating to CreateUsers (20150305003316)
|
|
14
|
-
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
|
15
|
-
[1m[35m (0.6ms)[0m DROP TABLE "users"
|
|
16
|
-
[1m[36mSQL (0.1ms)[0m [1mDELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = ?[0m [["version", "20150305003316"]]
|
|
17
|
-
[1m[35m (0.6ms)[0m commit transaction
|
|
18
|
-
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
19
|
-
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
20
|
-
Migrating to CreateUsers (20150305003414)
|
|
21
|
-
[1m[35m (0.0ms)[0m begin transaction
|
|
22
|
-
[1m[36m (0.3ms)[0m [1mCREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
|
23
|
-
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150305003414"]]
|
|
24
|
-
[1m[36m (2.0ms)[0m [1mcommit transaction[0m
|
|
25
|
-
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|