Skip to content

Commit 3d94a5f

Browse files
committed
Add test
1 parent fbd90db commit 3d94a5f

161 files changed

Lines changed: 4515 additions & 2122 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/landing/src/app/test-case/page.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,15 @@ export default async function TestCasePage() {
3939
let totalFail = 0
4040
let totalWorldTest = 0
4141
let totalWorldFail = 0
42+
let totalJeomsarangTest = 0
43+
let totalJeomsarangFail = 0
4244
const cases = Object.entries(ruleMap).map(([key, value]) => {
4345
totalTest += testStatus[key][0]
4446
totalFail += testStatus[key][1]
4547
totalWorldTest += testStatus[key][2]
4648
totalWorldFail += testStatus[key][3]
49+
totalJeomsarangTest += testStatus[key][4]
50+
totalJeomsarangFail += testStatus[key][5]
4751

4852
const isBut = value.title.includes('다만')
4953

@@ -67,6 +71,8 @@ export default async function TestCasePage() {
6771
</Text>
6872
<TestCaseStat
6973
fail={testStatus[key][1]}
74+
jeomsarangFail={testStatus[key][5]}
75+
jeomsarangTotal={testStatus[key][4]}
7076
success={testStatus[key][0] - testStatus[key][1]}
7177
total={testStatus[key][0]}
7278
worldFail={testStatus[key][3]}
@@ -78,10 +84,10 @@ export default async function TestCasePage() {
7884
</Text>
7985
</VStack>
8086
<TestCaseDisplayBoundary option="type" value="table">
81-
<TestCaseTable results={testStatus[key][4]} />
87+
<TestCaseTable results={testStatus[key][6]} />
8288
</TestCaseDisplayBoundary>
8389
<TestCaseDisplayBoundary option="type" value="list">
84-
<TestCaseList results={testStatus[key][4]} />
90+
<TestCaseList results={testStatus[key][6]} />
8591
</TestCaseDisplayBoundary>
8692
</TestCaseRuleContainer>
8793
</TestCaseDisplayBoundary>
@@ -107,6 +113,8 @@ export default async function TestCasePage() {
107113
</Text>
108114
<TestCaseStat
109115
fail={totalFail}
116+
jeomsarangFail={totalJeomsarangFail}
117+
jeomsarangTotal={totalJeomsarangTest}
110118
showTotal
111119
success={totalTest - totalFail}
112120
total={totalTest}

apps/landing/src/components/test-case/TestCaseStat.tsx

Lines changed: 71 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,59 @@
11
import { Center, Flex, Text } from '@devup-ui/react'
22
import { ComponentProps } from 'react'
33

4+
interface CompetitorStatProps {
5+
label: string
6+
total: number
7+
fail: number
8+
braillifyPercent: number
9+
showTotal: boolean
10+
}
11+
12+
function CompetitorStat({
13+
label,
14+
total,
15+
fail,
16+
braillifyPercent,
17+
showTotal,
18+
}: CompetitorStatProps) {
19+
const success = total - fail
20+
const percent = Math.round((success / total) * 100)
21+
22+
return (
23+
<Center bg="#2B2B2B" borderRadius="10px" gap="10px" px="16px" py="10px">
24+
<Text color="#888" typography="progress">
25+
{label}
26+
</Text>
27+
{showTotal && (
28+
<Text color="#888" typography="progress">
29+
전체 {total.toLocaleString()}
30+
</Text>
31+
)}
32+
<Text color="#888" typography="progress">
33+
성공 {success.toLocaleString()}
34+
</Text>
35+
<Text color="$error" typography="progress">
36+
실패 {fail.toLocaleString()}
37+
</Text>
38+
<Text
39+
color={percent < braillifyPercent ? '$error' : '$text'}
40+
typography="progress"
41+
>
42+
({percent}%)
43+
</Text>
44+
</Center>
45+
)
46+
}
47+
448
interface TestCaseStatProps extends ComponentProps<typeof Center<'div'>> {
549
showTotal?: boolean
650
total: number
751
success: number
852
fail: number
953
worldTotal?: number
1054
worldFail?: number
55+
jeomsarangTotal?: number
56+
jeomsarangFail?: number
1157
}
1258

1359
export function TestCaseStat({
@@ -17,19 +63,23 @@ export function TestCaseStat({
1763
fail,
1864
worldTotal,
1965
worldFail,
66+
jeomsarangTotal,
67+
jeomsarangFail,
2068
...props
2169
}: TestCaseStatProps) {
2270
const hasFail = fail > 0
2371
const braillifyPercent = Math.round((success / total) * 100)
2472

2573
const hasWorld = worldTotal != null && worldTotal > 0
26-
const worldSuccess = hasWorld ? worldTotal - worldFail! : 0
27-
const worldPercent = hasWorld
28-
? Math.round((worldSuccess / worldTotal) * 100)
29-
: 0
74+
const hasJeomsarang = jeomsarangTotal != null && jeomsarangTotal > 0
3075

3176
return (
32-
<Flex alignItems="center" gap="8px" styleOrder={1}>
77+
<Flex
78+
alignItems="center"
79+
flexWrap="wrap"
80+
gap="8px"
81+
styleOrder={1}
82+
>
3383
<Center
3484
bg="$menuHover"
3585
borderRadius="10px"
@@ -57,34 +107,22 @@ export function TestCaseStat({
57107
</Text>
58108
</Center>
59109
{hasWorld && (
60-
<Center
61-
bg="#2B2B2B"
62-
borderRadius="10px"
63-
gap="10px"
64-
px="16px"
65-
py="10px"
66-
>
67-
<Text color="#888" typography="progress">
68-
점자세상
69-
</Text>
70-
{showTotal && (
71-
<Text color="#888" typography="progress">
72-
전체 {worldTotal.toLocaleString()}
73-
</Text>
74-
)}
75-
<Text color="#888" typography="progress">
76-
성공 {worldSuccess.toLocaleString()}
77-
</Text>
78-
<Text color="$error" typography="progress">
79-
실패 {worldFail!.toLocaleString()}
80-
</Text>
81-
<Text
82-
color={worldPercent < braillifyPercent ? '$error' : '$text'}
83-
typography="progress"
84-
>
85-
({worldPercent}%)
86-
</Text>
87-
</Center>
110+
<CompetitorStat
111+
braillifyPercent={braillifyPercent}
112+
fail={worldFail!}
113+
label="점자세상"
114+
showTotal={showTotal}
115+
total={worldTotal}
116+
/>
117+
)}
118+
{hasJeomsarang && (
119+
<CompetitorStat
120+
braillifyPercent={braillifyPercent}
121+
fail={jeomsarangFail!}
122+
label="점사랑"
123+
showTotal={showTotal}
124+
total={jeomsarangTotal}
125+
/>
88126
)}
89127
</Flex>
90128
)

apps/landing/src/components/test-case/list/TestCaseList.tsx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,22 @@ import { TestStatus } from '@/types'
66
import TestCaseCircle from '../TestCaseCircle'
77
import { TestCaseDisplayBoundary } from '../TestCaseDisplayBoundary'
88

9-
export function TestCaseList({ results }: { results: TestStatus[4] }) {
9+
export function TestCaseList({ results }: { results: TestStatus[6] }) {
1010
return (
1111
<Grid gap="8px" gridTemplateColumns="repeat(auto-fill, minmax(16px, 1fr))">
1212
{results.map(
1313
(
14-
[text, note, expected, actual, isSuccess, world, worldIsSuccess],
14+
[
15+
text,
16+
note,
17+
expected,
18+
actual,
19+
isSuccess,
20+
world,
21+
worldIsSuccess,
22+
jeomsarang,
23+
jeomsarangIsSuccess,
24+
],
1525
idx,
1626
) => {
1727
const textParts = parseTextWithLaTeX(text)
@@ -47,6 +57,14 @@ export function TestCaseList({ results }: { results: TestStatus[4] }) {
4757
{worldIsSuccess ? '✅' : '❌'}
4858
</>
4959
) : null}
60+
{jeomsarang ? (
61+
<>
62+
<br />
63+
점사랑 :{' '}
64+
<Text wordBreak="break-all">{jeomsarang}</Text>{' '}
65+
{jeomsarangIsSuccess ? '✅' : '❌'}
66+
</>
67+
) : null}
5068
</Text>
5169
</Box>
5270
</TestCaseCircle>

apps/landing/src/components/test-case/table/TestCaseTable.tsx

Lines changed: 62 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,29 @@ import { TestStatus } from '@/types'
66

77
import { TestCaseDisplayBoundary } from '../TestCaseDisplayBoundary'
88

9-
export function TestCaseTable({ results }: { results: TestStatus[4] }) {
9+
function CompetitorCell({
10+
label,
11+
value,
12+
isSuccess,
13+
}: {
14+
label: string
15+
value: string
16+
isSuccess: boolean
17+
}) {
18+
if (!value) return <Text color="#666">-</Text>
19+
return (
20+
<Flex alignItems="center" gap="4px">
21+
<Text
22+
className={css({ color: isSuccess ? '$success' : '$error' })}
23+
whiteSpace="nowrap"
24+
>
25+
{isSuccess ? '일치' : '불일치'}
26+
</Text>
27+
</Flex>
28+
)
29+
}
30+
31+
export function TestCaseTable({ results }: { results: TestStatus[6] }) {
1032
return (
1133
<Table>
1234
<Thead
@@ -19,12 +41,23 @@ export function TestCaseTable({ results }: { results: TestStatus[4] }) {
1941
<Th>결과</Th>
2042
<Th>성공 여부</Th>
2143
<Th>점자세상</Th>
44+
<Th>점사랑</Th>
2245
</Tr>
2346
</Thead>
2447
<Tbody>
2548
{results.map(
2649
(
27-
[text, note, expected, actual, isSuccess, world, worldIsSuccess],
50+
[
51+
text,
52+
note,
53+
expected,
54+
actual,
55+
isSuccess,
56+
world,
57+
worldIsSuccess,
58+
jeomsarang,
59+
jeomsarangIsSuccess,
60+
],
2861
index,
2962
) => (
3063
<TestCaseDisplayBoundary
@@ -69,20 +102,18 @@ export function TestCaseTable({ results }: { results: TestStatus[4] }) {
69102
</Flex>
70103
</Td>
71104
<Td>
72-
{world ? (
73-
<Flex alignItems="center" gap="4px">
74-
<Text
75-
className={css({
76-
color: worldIsSuccess ? '$success' : '$error',
77-
})}
78-
whiteSpace="nowrap"
79-
>
80-
{worldIsSuccess ? '일치' : '불일치'}
81-
</Text>
82-
</Flex>
83-
) : (
84-
<Text color="#666">-</Text>
85-
)}
105+
<CompetitorCell
106+
isSuccess={worldIsSuccess}
107+
label="점자세상"
108+
value={world}
109+
/>
110+
</Td>
111+
<Td>
112+
<CompetitorCell
113+
isSuccess={jeomsarangIsSuccess}
114+
label="점사랑"
115+
value={jeomsarang}
116+
/>
86117
</Td>
87118
</Tr>
88119
<Tr
@@ -135,7 +166,21 @@ export function TestCaseTable({ results }: { results: TestStatus[4] }) {
135166
color: worldIsSuccess ? '$success' : '$error',
136167
})}
137168
>
138-
{worldIsSuccess ? '일치' : '불일치'} ({world})
169+
{worldIsSuccess ? '일치' : '불일치'}
170+
</Text>
171+
</Flex>
172+
) : null}
173+
{jeomsarang ? (
174+
<Flex alignItems="center" gap="10px" px="10px">
175+
<Text typography="bodyBold">점사랑</Text>
176+
<Text
177+
className={css({
178+
color: jeomsarangIsSuccess
179+
? '$success'
180+
: '$error',
181+
})}
182+
>
183+
{jeomsarangIsSuccess ? '일치' : '불일치'}
139184
</Text>
140185
</Flex>
141186
) : null}

apps/landing/src/types/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ export type TestStatus = [
55
fail: number,
66
worldTotal: number,
77
worldFail: number,
8+
jeomsarangTotal: number,
9+
jeomsarangFail: number,
810
Array<
911
[
1012
text: string,
@@ -14,6 +16,8 @@ export type TestStatus = [
1416
isSuccess: boolean,
1517
world: string,
1618
worldIsSuccess: boolean,
19+
jeomsarang: string,
20+
jeomsarangIsSuccess: boolean,
1721
]
1822
>,
1923
]

0 commit comments

Comments
 (0)