Skip to content

Commit

Permalink
Add acceptance test for part 2 in typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
mengdaming committed Oct 23, 2024
1 parent d749f70 commit 74ee277
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 17 deletions.
46 changes: 31 additions & 15 deletions InstructionsPart2.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,24 @@ For example for width = 3 and height = 2 the digit 2 will be:

Add the below acceptance test to your list of test cases.

### C++ Version

```cpp
TEST(Lcd, acceptance_test_scaling)
{
const auto expected =
" ___ ___ \n"
" | || |\n"
" | ___|| |\n"
" || | |\n"
" ||___ |___|\n";
EXPECT_EQ(expected, lcdConvert(120, 3, 2));
}
```
### Java Version
````java
```java
@Test
public void acceptance_test_scaling() {
int input = 120;
Expand All @@ -32,19 +47,20 @@ public void acceptance_test_scaling() {
+ " ||___ |___|\n";
assertEquals(expected, Lcd.convert(input, 3, 2));
}
````
```

### C++ Version
### Typescript Version

````cpp
TEST(Lcd, acceptance_test_scaling)
{
const auto expected =
" ___ ___ \n"
" | || |\n"
" | ___|| |\n"
" || | |\n"
" ||___ |___|\n";
EXPECT_EQ(expected, lcdConvert(120, 3, 2));
}
````
```typescript
test('acceptance test with scaling', () => {
const input = 120;
const expected: string
= ''
+ ' ___ ___ \n'
+ ' | || |\n'
+ ' | ___|| |\n'
+ ' || | |\n'
+ ' ||___ |___|\n';
expect(convert(input, 3, 2)).toEqual(expected);
});
```
4 changes: 2 additions & 2 deletions typescript/test/Lcd.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { convert } from '../src/Lcd';
describe('lcd', () => {
// Remove the ".skip" below to enable this test case
test.skip('acceptance test', () => {
let input: number = 120120120;
let expected: string
const input: number = 120120120;
const expected: string
= ' _ _ _ _ _ _ \n'
+ ' | _|| | | _|| | | _|| |\n'
+ ' ||_ |_| ||_ |_| ||_ |_|\n';
Expand Down

0 comments on commit 74ee277

Please sign in to comment.