summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ruby/find_match.rb2
-rw-r--r--tests/ruby/xkbparser.rb18
2 files changed, 14 insertions, 6 deletions
diff --git a/tests/ruby/find_match.rb b/tests/ruby/find_match.rb
index c1f2d11..5a613dd 100644
--- a/tests/ruby/find_match.rb
+++ b/tests/ruby/find_match.rb
@@ -30,7 +30,7 @@ newSyms.find_all do | key, value |
end
sorted.find_all do | symsName, diff |
- puts " #{symsName}, up to #{allSyms[symsName].rough_size} keys (difference #{diff.size})-> #{diff}"
+ puts " #{symsName}, up to #{allSyms[symsName].size} keys (difference #{diff.size})-> #{diff}"
end
end
diff --git a/tests/ruby/xkbparser.rb b/tests/ruby/xkbparser.rb
index a023dca..cc67c44 100644
--- a/tests/ruby/xkbparser.rb
+++ b/tests/ruby/xkbparser.rb
@@ -37,6 +37,7 @@ class Symbols < Hash
end
alias get_original []
+ alias keys_original keys
#
# Get the symbol, trying first own definitions, then walking through all
@@ -58,16 +59,23 @@ class Symbols < Hash
end
#
- # Approximate size - does not take into account overlapping key definitions
+ # All keys - including the ones specified in the included sections
#
- def rough_size()
- @includedSyms.inject(size) do | sum, symsName |
- syms = @symbolsList[symsName]
- syms.size + sum
+ def keys()
+ @includedSyms.inject(keys_original) do | rv, symsName |
+ syms = @symbolsList[symsName]
+ rv | syms.keys
end
end
#
+ # Size - takes into account overlapping key definitions
+ #
+ def size()
+ keys.size()
+ end
+
+ #
# Create a hash including all elements of this hash which are not in the
# other hash, use symbols + and * for marking the elements which existed in
# the original hash (+ if not existed)