Set deterkite_method input to const
This commit is contained in:
parent
562df68c92
commit
7b3833633b
@ -5,6 +5,6 @@ set(CMAKE_CXX_STANDARD 14)
|
|||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
add_subdirectory(Demo)
|
|
||||||
add_subdirectory(QRCodeLibrary)
|
add_subdirectory(QRCodeLibrary)
|
||||||
|
add_subdirectory(Demo)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "Method.hpp"
|
#include "Method.hpp"
|
||||||
#include "Tables.hpp"
|
#include "Tables.hpp"
|
||||||
|
|
||||||
QRCodeMethod Method::determite_method(byte_list& input)
|
QRCodeMethod Method::determite_method(const byte_list& input)
|
||||||
{
|
{
|
||||||
QRCodeMethod type = QRCodeMethod::Numeric;
|
QRCodeMethod type = QRCodeMethod::Numeric;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ enum class CorrectionLevel {
|
|||||||
|
|
||||||
class Method {
|
class Method {
|
||||||
public:
|
public:
|
||||||
static QRCodeMethod determite_method(byte_list& input);
|
static QRCodeMethod determite_method(const byte_list& input);
|
||||||
|
|
||||||
static constexpr bool is_num(char ch) { return ch >= '0' && ch <= '9'; };
|
static constexpr bool is_num(char ch) { return ch >= '0' && ch <= '9'; };
|
||||||
};
|
};
|
||||||
|
@ -6,13 +6,9 @@
|
|||||||
#include "../QRCodeLibrary/Method.hpp"
|
#include "../QRCodeLibrary/Method.hpp"
|
||||||
|
|
||||||
TEST(MethodTests, DetermitesStringMethod) {
|
TEST(MethodTests, DetermitesStringMethod) {
|
||||||
string a1("123");
|
EXPECT_EQ(Method::determite_method(str_to_bytes("123")), QRCodeMethod::Numeric);
|
||||||
string a2("ABC");
|
EXPECT_EQ(Method::determite_method(str_to_bytes("ABC")), QRCodeMethod::Alphabetic);
|
||||||
string a3("ghfjghfj gfjhgd");
|
EXPECT_EQ(Method::determite_method(str_to_bytes("ghfjghfj gfjhgd")), QRCodeMethod::Byte);
|
||||||
|
|
||||||
EXPECT_EQ(Method::determite_method(str_to_bytes(a1)), QRCodeMethod::Numeric);
|
|
||||||
EXPECT_EQ(Method::determite_method(str_to_bytes(a2)), QRCodeMethod::Alphabetic);
|
|
||||||
EXPECT_EQ(Method::determite_method(str_to_bytes(a3)), QRCodeMethod::Byte);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(MethodTests, ChecksNumber) {
|
TEST(MethodTests, ChecksNumber) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user