diff options
author | svu <svu> | 2006-10-26 23:53:18 +0000 |
---|---|---|
committer | svu <svu> | 2006-10-26 23:53:18 +0000 |
commit | 7bee574858addc577cba8ade496debd3986fd7b8 (patch) | |
tree | 3334ee15157ad7a12e01f17fce6c0ecbc8689bed /tests | |
parent | 483fbaa3c3f1a71a351134157609212cdd132843 (diff) |
redefined keys and size in xkb_symbols
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ruby/find_match.rb | 2 | ||||
-rw-r--r-- | tests/ruby/xkbparser.rb | 18 |
2 files changed, 14 insertions, 6 deletions
diff --git a/tests/ruby/find_match.rb b/tests/ruby/find_match.rb index c1f2d118..5a613dd9 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 a023dca6..cc67c447 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) |