B2G/gecko/toolkit/content/tests/unit/test_dict.js
// This is used by both test_listers and test_iterators.
This is used by both test_listers and test_iterators.
This is used by both test_listers and test_iterators .
function _check_lists(keys, values, items) {
  do_check_eq(keys.length, 2);
  do_check_true(keys.indexOf("x") != -1);
  do_check_true(keys.indexOf("y") != -1);
  do_check_eq(values.length, 2);
  do_check_true(values.indexOf("a") != -1);
  do_check_true(values.indexOf("b") != -1);
  do_check_eq(items.length, 2);
  do_check_eq(items[0].length, 2);
  do_check_eq(items[1].length, 2);
  let ix = (items[0][0] == "x") ? 0 : 1;
  let iy = (ix == 0) ? 1 : 0;
  do_check_eq(items[ix][0], "x");
  do_check_eq(items[ix][1], "a");
  do_check_eq(items[iy][0], "y");
  do_check_eq(items[iy][1], "b");
}
function _check_lists ( keys , values , items ) { do_check_eq ( keys . length , 2 ) ; do_check_true ( keys . indexOf ( "x" ) != - 1 ) ; do_check_true ( keys . indexOf ( "y" ) != - 1 ) ; do_check_eq ( values . length , 2 ) ; do_check_true ( values . indexOf ( "a" ) != - 1 ) ; do_check_true ( values . indexOf ( "b" ) != - 1 ) ; do_check_eq ( items . length , 2 ) ; do_check_eq ( items [ 0 ] . length , 2 ) ; do_check_eq ( items [ 1 ] . length , 2 ) ; let ix = ( items [ 0 ] [ 0 ] == "x" ) ? 0 : 1 ; let iy = ( ix == 0 ) ? 1 : 0 ; do_check_eq ( items [ ix ] [ 0 ] , "x" ) ; do_check_eq ( items [ ix ] [ 1 ] , "a" ) ; do_check_eq ( items [ iy ] [ 0 ] , "y" ) ; do_check_eq ( items [ iy ] [ 1 ] , "b" ) ; }
This is used by both test_listers and test_iterators.
This is used by both test_listers and test_iterators .
// This is a little more tricky -- we need to check that one of the two // entries is ["x", "a"] and the other is ["y", "b"].