PHP and Javascript implementations of a simple markdown parser
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

CellAddressRangeTests.js 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. class CellAddressRangeTests extends BaseTest {
  2. test_iterator() {
  3. const grid = new SpreadsheetGrid(3, 4);
  4. let range = new CellAddressRange(new CellAddress(0, 0), new CellAddress(2, 3));
  5. var visited = [];
  6. var sanity = 100;
  7. for (const address of range.cellsIn(grid)) {
  8. visited.push(address.name);
  9. if (sanity-- < 0) break;
  10. }
  11. const actual = visited.join(',');
  12. const expected = 'A1,A2,A3,A4,B1,B2,B3,B4,C1,C2,C3,C4';
  13. this.assertEqual(expected, actual);
  14. }
  15. test_iterator_column() {
  16. const grid = new SpreadsheetGrid(3, 4);
  17. let range = new CellAddressRange(new CellAddress(1, -1), new CellAddress(2, -1));
  18. var visited = [];
  19. var sanity = 100;
  20. for (const address of range.cellsIn(grid)) {
  21. visited.push(address.name);
  22. if (sanity-- < 0) break;
  23. }
  24. const actual = visited.join(',');
  25. const expected = 'B1,B2,B3,B4,C1,C2,C3,C4';
  26. this.assertEqual(expected, actual);
  27. }
  28. test_iterator_beyondBounds() {
  29. const grid = new SpreadsheetGrid(3, 4);
  30. let range = new CellAddressRange(new CellAddress(0, 1), new CellAddress(9, 9));
  31. var visited = [];
  32. var sanity = 100;
  33. for (const address of range.cellsIn(grid)) {
  34. visited.push(address.name);
  35. if (sanity-- < 0) break;
  36. }
  37. const actual = visited.join(',');
  38. const expected = 'A2,A3,A4,B2,B3,B4,C2,C3,C4';
  39. this.assertEqual(expected, actual);
  40. }
  41. test_iterator_outOfBounds() {
  42. const grid = new SpreadsheetGrid(3, 4);
  43. let range = new CellAddressRange(new CellAddress(5, 0), new CellAddress(5, 9));
  44. var visited = [];
  45. var sanity = 100;
  46. for (const address of range.cellsIn(grid)) {
  47. visited.push(address.name);
  48. if (sanity-- < 0) break;
  49. }
  50. const actual = visited.join(',');
  51. const expected = '';
  52. this.assertEqual(expected, actual);
  53. }
  54. }