<commit_before>local table = require("Quadtastic.tableplus")

do
  local t = {
    foo = {
      bar = {
        boo = {
          fud = 42
        }
      }
    }
  }
  -- Get existing value
  assert(table.get(t, "foo", "bar", "boo", "fud") == 42)
  -- Set new value
  table.set(t, 3.14, "foo", "bar", "pi")
  assert(table.get(t, "foo", "bar", "pi") == 3.14)
  -- Replace existing value
  table.set(t, 43, "foo", "bar", "boo", "fud")
  assert(table.get(t, "foo", "bar", "boo", "fud") == 43)
end

do
  local t = {
    foo = {
      bar = {
        {
          deadend = 1234
        },
        boo = {
          fud = 42,
        }
      }
    }
  }
  local expected = {"foo", "bar", "boo", "fud"}
  local found = {table.find_key(t, 42)}
  assert(#expected == #found)
  for i=1,#expected do
    assert(expected[i] == found[i])
  end
  assert(table.get(t, table.find_key(t, 42)) == 42)
end<commit_msg>Add test for mixed numeric and string keys<commit_after>local table = require("Quadtastic.tableplus")

do
  local t = {
    foo = {
      bar = {
        boo = {
          fud = 42
        }
      }
    }
  }
  -- Get existing value
  assert(table.get(t, "foo", "bar", "boo", "fud") == 42)
  -- Set new value
  table.set(t, 3.14, "foo", "bar", "pi")
  assert(table.get(t, "foo", "bar", "pi") == 3.14)
  -- Replace existing value
  table.set(t, 43, "foo", "bar", "boo", "fud")
  assert(table.get(t, "foo", "bar", "boo", "fud") == 43)
end

do
  local t = {
    foo = {
      bar = {
        {
          deadend = 1234
        },
        boo = {
          fud = 42,
        }
      }
    }
  }
  local expected = {"foo", "bar", "boo", "fud"}
  local found = {table.find_key(t, 42)}
  assert(#expected == #found)
  for i=1,#expected do
    assert(expected[i] == found[i])
  end
  assert(table.get(t, table.find_key(t, 42)) == 42)
end

-- Test mixed numeric and string keys
do
  local t = {
    foo = {
      {
        boo = {
          fud = 43,
        }
      },
      {
        boo = {
          fud = 42,
        }
      }
    }
  }
  local expected = {"foo", 2, "boo", "fud"}
  local found = {table.find_key(t, 42)}
  assert(#expected == #found)
  for i=1,#expected do
    assert(expected[i] == found[i])
  end
  table.set(t, 45, table.find_key(t, 43))
  assert(table.get(t, table.find_key(t, 45)) == 45)
end
{'fraction_non_alphanumeric': 0.19142485924642702, 'fraction_numerical': 0.030316154179298397, 'mean_word_length': 1.9351969504447268, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1326717', 'n_tokens_mistral': 978, 'n_tokens_neox': 908, 'n_words': 213}