-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from sir-gon/develop
BASIC: show limits of some types.
- Loading branch information
Showing
3 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#pragma once | ||
|
||
namespace basic { | ||
|
||
void limits(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include <exercises/basic/limits.hpp> | ||
|
||
#include <iostream> | ||
#include <limits> | ||
|
||
namespace basic { | ||
|
||
void limits() { | ||
std::cout << "type\t│ lowest()\t│ min()\t\t│ max()\n" | ||
<< "bool\t│ " << std::numeric_limits<bool>::lowest() << "\t\t│ " | ||
<< std::numeric_limits<bool>::min() << "\t\t│ " | ||
<< std::numeric_limits<bool>::max() << '\n' | ||
<< "uchar\t│ " << +std::numeric_limits<unsigned char>::lowest() | ||
<< "\t\t│ " << +std::numeric_limits<unsigned char>::min() | ||
<< "\t\t│ " << +std::numeric_limits<unsigned char>::max() << '\n' | ||
<< "int\t│ " << std::numeric_limits<int>::lowest() << "\t│ " | ||
<< std::numeric_limits<int>::min() << "\t│ " | ||
<< std::numeric_limits<int>::max() << '\n' | ||
<< "float\t│ " << std::numeric_limits<float>::lowest() << "\t│ " | ||
<< std::numeric_limits<float>::min() << "\t│ " | ||
<< std::numeric_limits<float>::max() << '\n' | ||
<< "double\t│ " << std::numeric_limits<double>::lowest() << "\t│ " | ||
<< std::numeric_limits<double>::min() << "\t│ " | ||
<< std::numeric_limits<double>::max() << '\n'; | ||
} | ||
} // namespace basic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include <catch2/catch_test_macros.hpp> | ||
|
||
#include <exercises/basic/limits.hpp> | ||
|
||
TEST_CASE("limits", "[basic]") { basic::limits(); } |