Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rpn_collab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
QSUE Team B
rpn_collab
Commits
9fc66b58
Commit
9fc66b58
authored
5 years ago
by
Meik Selig
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
https://git.fh-muenster.de/dp173259/rpn_collab
into fix-missing-operands
parents
22c9e2ff
2cf4381a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
test/test.cpp
+29
-0
29 additions, 0 deletions
test/test.cpp
with
30 additions
and
0 deletions
.gitignore
+
1
−
0
View file @
9fc66b58
...
@@ -4,3 +4,4 @@ result
...
@@ -4,3 +4,4 @@ result
calc
calc
fuzz_calc
fuzz_calc
unit_test
unit_test
core.*
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/test.cpp
+
29
−
0
View file @
9fc66b58
...
@@ -38,3 +38,32 @@ TEST_CASE( "Test modulo function", "[calc]") {
...
@@ -38,3 +38,32 @@ TEST_CASE( "Test modulo function", "[calc]") {
REQUIRE
(
evaluate
(
"32%"
)
==
1
);
REQUIRE
(
evaluate
(
"32%"
)
==
1
);
REQUIRE
(
evaluate
(
"51%"
)
==
0
);
REQUIRE
(
evaluate
(
"51%"
)
==
0
);
}
}
TEST_CASE
(
"division by zero is detected and exception is thrown"
,
"[calc]"
)
{
REQUIRE_THROWS
(
evaluate
(
"40/"
)
);
REQUIRE_THROWS
(
evaluate
(
"00/"
)
);
REQUIRE_THROWS
(
evaluate
(
"90/"
)
);
}
TEST_CASE
(
"Basic power function test"
,
"[calc]"
)
{
REQUIRE
(
evaluate
(
"22^"
)
==
4
);
REQUIRE
(
evaluate
(
"43^"
)
==
64
);
REQUIRE
(
evaluate
(
"25^"
)
==
32
);
}
TEST_CASE
(
"Parameters are misaligned and excpetion is thrown"
,
"[calc]"
)
{
// REQUIRE_THROWS( evaluate("40*/") );
// REQUIRE_THROWS( evaluate("14--") );
// REQUIRE_THROWS( evaluate("1+1") );
// REQUIRE_THROWS( evaluate("+11") );
}
TEST_CASE
(
"Two Operants in a row are detected and exception is thrown"
,
"[calc]"
)
{
//REQUIRE_THROWS( evaluate("11+3-+4") );
//REQUIRE_THROWS( evaluate("11/3*+4") );
}
TEST_CASE
(
"Unrecognized characters are detected and exception is thrown"
,
"[calc]"
)
{
REQUIRE_THROWS
(
evaluate
(
"11+3?4"
)
);
REQUIRE_THROWS
(
evaluate
(
"1F+"
)
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment