Skip to content

Commit d6a9d9e

Browse files
committed
Added test cases, re-made with hoe rather than jeweler
1 parent f2d7e8a commit d6a9d9e

17 files changed

+681
-299
lines changed

.autotest

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# -*- ruby -*-
2+
3+
require 'autotest/restart'
4+
5+
# Autotest.add_hook :initialize do |at|
6+
# at.extra_files << "../some/external/dependency.rb"
7+
#
8+
# at.libs << ":../some/external"
9+
#
10+
# at.add_exception 'vendor'
11+
#
12+
# at.add_mapping(/dependency.rb/) do |f, _|
13+
# at.files_matching(/test_.*rb$/)
14+
# end
15+
#
16+
# %w(TestA TestB).each do |klass|
17+
# at.extra_class_map[klass] = "test/test_misc.rb"
18+
# end
19+
# end
20+
21+
# Autotest.add_hook :run_command do |at|
22+
# system "rake build"
23+
# end

.document

Lines changed: 0 additions & 5 deletions
This file was deleted.

.gitignore

Lines changed: 0 additions & 42 deletions
This file was deleted.

.rspec

Lines changed: 0 additions & 1 deletion
This file was deleted.

Gemfile

Lines changed: 0 additions & 13 deletions
This file was deleted.

History.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
=== 1.0.0 / 2012-08-05
2+
3+
* 1 major enhancement
4+
5+
* Birthday!
6+

LICENSE.txt

Lines changed: 0 additions & 20 deletions
This file was deleted.

Manifest.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.autotest
2+
History.txt
3+
Manifest.txt
4+
README.txt
5+
Rakefile
6+
lib/multiset.rb
7+
lib/multiset/libmultimap.rb
8+
lib/multiset/libmultiset.rb
9+
spec/multiset_spec.rb
10+
spec/spec_helper.rb

README.rdoc

Lines changed: 0 additions & 20 deletions
This file was deleted.

README.txt

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
= multiset
2+
3+
* Ruby implementation of the multiset (http://maraigue.hhiro.net/multiset/)
4+
5+
== DESCRIPTION:
6+
7+
Unlike ordinary set(see Ruby documentation for "set" library), multiset can contain two or more same items.
8+
9+
Set[:a,:b,:c,:b,:b,:c] # => #<Set: {:b, :c, :a}>
10+
Multiset[:a,:b,:c,:b,:b,:c] # => #<Multiset:#3 :b, #2 :c, #1 :a>
11+
12+
Multisets are typically used for counting elements and their appearances in collections.
13+
14+
== FEATURES/PROBLEMS:
15+
16+
* Nothing for now
17+
18+
== SYNOPSIS:
19+
20+
# Creating a multiset
21+
Set[:a,:b,:c,:b,:b,:c] # => #<Set: {:b, :c, :a}>
22+
Multiset[:a,:b,:c,:b,:b,:c] # => #<Multiset:#3 :b, #2 :c, #1 :a>
23+
24+
# Counting the appearances of characters in a string
25+
m = Multiset.new
26+
"abracadabra".each_char do |c| # replace with 'each_byte' in Ruby 1.8.6 or before
27+
m << c
28+
end
29+
p m
30+
# => #<Multiset:#5 "a", #2 "b", #2 "r", #1 "c", #1 "d">
31+
32+
# The same
33+
Multiset.new("abracadabra".split(//))
34+
# => #<Multiset:#5 "a", #2 "b", #2 "r", #1 "c", #1 "d">
35+
36+
# The same, but available with Ruby 1.8.7 or after
37+
Multiset.new("abracadabra".each_char)
38+
# => #<Multiset:#5 "a", #2 "b", #2 "r", #1 "c", #1 "d">
39+
40+
See also: http://maraigue.hhiro.net/multiset/reverseref.en.html
41+
42+
== REQUIREMENTS:
43+
44+
No specific external libraries/tools are required.
45+
46+
== INSTALL:
47+
48+
gem install multiset
49+
50+
== DEVELOPERS:
51+
52+
After checking out the source, run:
53+
54+
$ rake newb
55+
56+
This task will install any missing dependencies, run the tests/specs,
57+
and generate the RDoc.
58+
59+
== LICENSE:
60+
61+
(The MIT License)
62+
63+
Copyright (c) 2012 FIX
64+
65+
Permission is hereby granted, free of charge, to any person obtaining
66+
a copy of this software and associated documentation files (the
67+
'Software'), to deal in the Software without restriction, including
68+
without limitation the rights to use, copy, modify, merge, publish,
69+
distribute, sublicense, and/or sell copies of the Software, and to
70+
permit persons to whom the Software is furnished to do so, subject to
71+
the following conditions:
72+
73+
The above copyright notice and this permission notice shall be
74+
included in all copies or substantial portions of the Software.
75+
76+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
77+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
78+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
79+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
80+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
81+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
82+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)