Skip to main content
Commonmark migration
Source Link
Community Bot

#Putting test cases in a hard to use format

Putting test cases in a hard to use format

#Do This:

Do This:

#DON'T Do This:

DON'T Do This:

#DON'T Do This:

DON'T Do This:

#DON'T Do This:

DON'T Do This:

#Putting test cases in a hard to use format

#Do This:

#DON'T Do This:

#DON'T Do This:

#DON'T Do This:

Putting test cases in a hard to use format

Do This:

DON'T Do This:

DON'T Do This:

DON'T Do This:

deleted 1 character in body
Source Link
Calvin's Hobbies

#Putting test cases in a hard to use formatsformat

Supplying test cases is always a good idea, but people are more likely to use them (and thus have better tested code) if they can easily be copied and pasted into a test suite.

So format your test cases as simply and as consistently as possible, preferably in a single code block. If you have lots of test cases and you want to section them out by type, put empty lines between sections instead of using several separate code blocks.

Be sure to include any examples used during explanation as test cases. People may otherwise forget important examples while focusing on test cases.

#Do This:

Input -> Output
cat -> kitten
dog -> puppy
seal -> pup
bear -> cub
cow -> calf
bird -> chick
echidna -> puggle

Replace -> with something else if the - and > might get confused with the input and output. Don't use (right arrow) or other Non-ASCII since not all languages/compilers may allow it.

#DON'T Do This:

+---------+--------+
|  Input  | Output |
+---------+--------+
| cat     | kitten |
| dog     | puppy  |
| seal    | pup    |
| bear    | cub    |
| cow     | calf   |
| bird    | chick  |
| echidna | puggle |
+---------+--------+

Yes, it looks nicer, but it's more hassle to get the pure data.

#DON'T Do This:

The inputs cat, dog seal, bear, cow, bird, and echidna have the respective outputs kitten, puppy, pup, cub, calf, chick, and puggle.

#DON'T Do This:

The input

cat

has output

kitten

The input

dog

has output

puppy

Likewise, the input

seal

has output

pup

and the input

bear

has output

cub

and the input

cow

has output

calf

and the input

bird

has output

chick

and, finally, the input

echidna

has output

puggle

Yes, I have been guilty of this. No, I am not going to fix all my old challenges.

#Putting test cases in a hard to use formats

Supplying test cases is always a good idea, but people are more likely to use them (and thus have better tested code) if they can easily be copied and pasted into a test suite.

So format your test cases as simply and as consistently as possible, preferably in a single code block. If you have lots of test cases and you want to section them out by type, put empty lines between sections instead of using several separate code blocks.

Be sure to include any examples used during explanation as test cases. People may otherwise forget important examples while focusing on test cases.

#Do This:

Input -> Output
cat -> kitten
dog -> puppy
seal -> pup
bear -> cub
cow -> calf
bird -> chick
echidna -> puggle

Replace -> with something else if the - and > might get confused with the input and output. Don't use (right arrow) or other Non-ASCII since not all languages/compilers may allow it.

#DON'T Do This:

+---------+--------+
|  Input  | Output |
+---------+--------+
| cat     | kitten |
| dog     | puppy  |
| seal    | pup    |
| bear    | cub    |
| cow     | calf   |
| bird    | chick  |
| echidna | puggle |
+---------+--------+

Yes, it looks nicer, but it's more hassle to get the pure data.

#DON'T Do This:

The inputs cat, dog seal, bear, cow, bird, and echidna have the respective outputs kitten, puppy, pup, cub, calf, chick, and puggle.

#DON'T Do This:

The input

cat

has output

kitten

The input

dog

has output

puppy

Likewise, the input

seal

has output

pup

and the input

bear

has output

cub

and the input

cow

has output

calf

and the input

bird

has output

chick

and, finally, the input

echidna

has output

puggle

Yes, I have been guilty of this. No, I am not going to fix all my old challenges.

#Putting test cases in a hard to use format

Supplying test cases is always a good idea, but people are more likely to use them (and thus have better tested code) if they can easily be copied and pasted into a test suite.

So format your test cases as simply and as consistently as possible, preferably in a single code block. If you have lots of test cases and you want to section them out by type, put empty lines between sections instead of using several separate code blocks.

Be sure to include any examples used during explanation as test cases. People may otherwise forget important examples while focusing on test cases.

#Do This:

Input -> Output
cat -> kitten
dog -> puppy
seal -> pup
bear -> cub
cow -> calf
bird -> chick
echidna -> puggle

Replace -> with something else if the - and > might get confused with the input and output. Don't use (right arrow) or other Non-ASCII since not all languages/compilers may allow it.

#DON'T Do This:

+---------+--------+
|  Input  | Output |
+---------+--------+
| cat     | kitten |
| dog     | puppy  |
| seal    | pup    |
| bear    | cub    |
| cow     | calf   |
| bird    | chick  |
| echidna | puggle |
+---------+--------+

Yes, it looks nicer, but it's more hassle to get the pure data.

#DON'T Do This:

The inputs cat, dog seal, bear, cow, bird, and echidna have the respective outputs kitten, puppy, pup, cub, calf, chick, and puggle.

#DON'T Do This:

The input

cat

has output

kitten

The input

dog

has output

puppy

Likewise, the input

seal

has output

pup

and the input

bear

has output

cub

and the input

cow

has output

calf

and the input

bird

has output

chick

and, finally, the input

echidna

has output

puggle

Yes, I have been guilty of this. No, I am not going to fix all my old challenges.

Source Link
Calvin's Hobbies

#Putting test cases in a hard to use formats

Supplying test cases is always a good idea, but people are more likely to use them (and thus have better tested code) if they can easily be copied and pasted into a test suite.

So format your test cases as simply and as consistently as possible, preferably in a single code block. If you have lots of test cases and you want to section them out by type, put empty lines between sections instead of using several separate code blocks.

Be sure to include any examples used during explanation as test cases. People may otherwise forget important examples while focusing on test cases.

#Do This:

Input -> Output
cat -> kitten
dog -> puppy
seal -> pup
bear -> cub
cow -> calf
bird -> chick
echidna -> puggle

Replace -> with something else if the - and > might get confused with the input and output. Don't use (right arrow) or other Non-ASCII since not all languages/compilers may allow it.

#DON'T Do This:

+---------+--------+
|  Input  | Output |
+---------+--------+
| cat     | kitten |
| dog     | puppy  |
| seal    | pup    |
| bear    | cub    |
| cow     | calf   |
| bird    | chick  |
| echidna | puggle |
+---------+--------+

Yes, it looks nicer, but it's more hassle to get the pure data.

#DON'T Do This:

The inputs cat, dog seal, bear, cow, bird, and echidna have the respective outputs kitten, puppy, pup, cub, calf, chick, and puggle.

#DON'T Do This:

The input

cat

has output

kitten

The input

dog

has output

puppy

Likewise, the input

seal

has output

pup

and the input

bear

has output

cub

and the input

cow

has output

calf

and the input

bird

has output

chick

and, finally, the input

echidna

has output

puggle

Yes, I have been guilty of this. No, I am not going to fix all my old challenges.