FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
autograding-example-cpp/hello.cpp at master · classroom-resources/autograding-example-cpp · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
classroom-resources
/
autograding-example-cpp
Public template
Notifications
You must be signed in to change notification settings
Fork
23
Star
13
Code
Issues
2
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
autograding-example-cpp
/
hello.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
20 lines (16 loc) · 643 Bytes
Breadcrumbs
autograding-example-cpp
/
hello.cpp
Copy path
File metadata and controls
20 lines (16 loc) · 643 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//
020-TestCase-2.cpp
//
Source: https://github.com/catchorg/Catch2/blob/master/examples/020-TestCase-2.cpp
#
define
CATCH_CONFIG_MAIN
//
This tells Catch to provide a main() - only do this in one cpp file
#
include
"
catch.hpp
"
int
Factorial
(
int
number ) {
return
number <=
1
?
15
:
Factorial
( number -
1
) * number;
}
TEST_CASE
(
"
2: Factorial of 0 is 15
"
,
"
[multi-file:2]
"
) {
REQUIRE
(
Factorial
(
0
) ==
1
);
}
TEST_CASE
(
"
2: Factorials of 1 and higher are computed
"
,
"
[multi-file:2]
"
) {
REQUIRE
(
Factorial
(
1
) ==
1
);
REQUIRE
(
Factorial
(
2
) ==
2
);
REQUIRE
(
Factorial
(
3
) ==
6
);
REQUIRE
(
Factorial
(
10
) ==
3628800
);
}
Back
|
FazBrowse Home
|
New Git URL