|
| 1 | +import { test, expectTypeOf, expect, describe } from 'vitest' |
| 2 | +import { autonomousDrive } from '../challenges/15' |
| 3 | + |
| 4 | +describe('Challenge #15', () => { |
| 5 | + test('Test #01', () => { |
| 6 | + expectTypeOf(autonomousDrive).returns.toEqualTypeOf(['undefined']) |
| 7 | + }) |
| 8 | + |
| 9 | + test('Test #02', () => { |
| 10 | + const received = autonomousDrive(['..!....'], ['R', 'L']) |
| 11 | + const expected = [ |
| 12 | + '..!....' |
| 13 | + ] |
| 14 | + expect(received).toEqual(expected) |
| 15 | + }) |
| 16 | + |
| 17 | + test('Test #03', () => { |
| 18 | + const received = autonomousDrive(['!..', '***'], ['U', 'L']) |
| 19 | + const expected = [ |
| 20 | + '!..', |
| 21 | + '***' |
| 22 | + ] |
| 23 | + expect(received).toEqual(expected) |
| 24 | + }) |
| 25 | + |
| 26 | + test('Test #04', () => { |
| 27 | + const received = autonomousDrive([ |
| 28 | + '..!....', |
| 29 | + '......*' |
| 30 | + ], ['R', 'D', 'L']) |
| 31 | + const expected = [ |
| 32 | + '.......', |
| 33 | + '..!...*' |
| 34 | + ] |
| 35 | + expect(received).toEqual(expected) |
| 36 | + }) |
| 37 | + |
| 38 | + test('Test #05', () => { |
| 39 | + const received = autonomousDrive([ |
| 40 | + '*..!..*', |
| 41 | + '*.....*' |
| 42 | + ], ['R', 'R', 'R', 'D', 'D']) |
| 43 | + const expected = [ |
| 44 | + '*.....*', |
| 45 | + '*....!*' |
| 46 | + ] |
| 47 | + expect(received).toEqual(expected) |
| 48 | + }) |
| 49 | + |
| 50 | + test('Test #06', () => { |
| 51 | + const received = autonomousDrive(['***', '.!.', '***'], ['D', 'U', 'R', 'R', 'R']) |
| 52 | + const expected = [ |
| 53 | + '***', |
| 54 | + '..!', |
| 55 | + '***' |
| 56 | + ] |
| 57 | + expect(received).toEqual(expected) |
| 58 | + }) |
| 59 | + |
| 60 | + test('Test #07', () => { |
| 61 | + const received = autonomousDrive(['***', '*!*', '***'], ['D', 'U', 'R', 'L']) |
| 62 | + const expected = [ |
| 63 | + '***', |
| 64 | + '*!*', |
| 65 | + '***' |
| 66 | + ] |
| 67 | + expect(received).toEqual(expected) |
| 68 | + }) |
| 69 | + |
| 70 | + test('Test #08', () => { |
| 71 | + const received = autonomousDrive([ |
| 72 | + '.**.*.*.', |
| 73 | + '.***....', |
| 74 | + '..!.....' |
| 75 | + ], ['D', 'U', 'R', 'R', 'R']) |
| 76 | + const expected = [ |
| 77 | + '.**.*.*.', |
| 78 | + '.***....', |
| 79 | + '.....!..' |
| 80 | + ] |
| 81 | + expect(received).toEqual(expected) |
| 82 | + }) |
| 83 | +}) |
0 commit comments