summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorsvu <svu>2006-10-26 23:53:18 +0000
committersvu <svu>2006-10-26 23:53:18 +0000
commit7bee574858addc577cba8ade496debd3986fd7b8 (patch)
tree3334ee15157ad7a12e01f17fce6c0ecbc8689bed /tests
parent483fbaa3c3f1a71a351134157609212cdd132843 (diff)
redefined keys and size in xkb_symbols
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)