From 7bee574858addc577cba8ade496debd3986fd7b8 Mon Sep 17 00:00:00 2001 From: svu Date: Thu, 26 Oct 2006 23:53:18 +0000 Subject: redefined keys and size in xkb_symbols --- tests/ruby/find_match.rb | 2 +- tests/ruby/xkbparser.rb | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'tests') 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,15 +59,22 @@ 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 -- cgit v1.2.3