Added unfinished implementation of BitArrayTests

This commit is contained in:
favoritas37 2016-07-21 01:49:43 +03:00
parent bcc4f016d4
commit 7ca98d0365
4 changed files with 64 additions and 2 deletions

View File

@ -5,6 +5,7 @@
#include "TestCase.h"
#include "zxing/qrcode/encoder/MatrixUtilTests.h"
#include "zxing/qrcode/encoder/MaskUtilTests.h"
#include "zxing/qrcode/encoder/BitArrayTests.h"
namespace zxing {
namespace qrcode {
@ -23,6 +24,9 @@ void EncodeValidator::execute()
MaskUtilTests t1;
t1.execute();
BitArrayTests t2;
t2.execute();
}
catch(zxing::Exception &e)
{

View File

@ -15,7 +15,8 @@ SOURCES += main.cpp \
ValidationStats.cpp \
EncodeValidator.cpp \
zxing/qrcode/encoder/MatrixUtilTests.cpp \
zxing/qrcode/encoder/MaskUtilTests.cpp
zxing/qrcode/encoder/MaskUtilTests.cpp \
zxing/qrcode/encoder/BitArrayTests.cpp
HEADERS += \
DecodeValidator.h \
@ -23,6 +24,7 @@ HEADERS += \
EncodeValidator.h \
zxing/qrcode/encoder/MatrixUtilTests.h \
TestCase.h \
zxing/qrcode/encoder/MaskUtilTests.h
zxing/qrcode/encoder/MaskUtilTests.h \
zxing/qrcode/encoder/BitArrayTests.h
include(../../../src/QZXing.pri)

View File

@ -0,0 +1,30 @@
#include "BitArrayTests.h"
namespace zxing{
namespace qrcode{
namespace tests{
BitArrayTests::BitArrayTests()
{
}
void BitArrayTests::execute()
{
}
long zxing::qrcode::tests::BitArrayTests::getUnsignedInt(BitArray &v, int index)
{
long result = 0L;
for (int i = 0, offset = index << 3; i < 32; i++) {
if (v.get(offset + i)) {
result |= 1L << (31 - i);
}
}
return result;
}
}
}
}

View File

@ -0,0 +1,26 @@
#ifndef BITARRAYTESTS_H
#define BITARRAYTESTS_H
#include "TestCase.h"
#include "zxing/common/BitArray.h"
namespace zxing{
namespace qrcode{
namespace tests{
class BitArrayTests : public TestCase
{
private:
static long getUnsignedInt(BitArray &v, int index);
public:
BitArrayTests();
void execute();
};
}
}
}
#endif // BITARRAYTESTS_H