| 1 | 
 /* | 
 
 
 
 
 
 | 2 | 
 Copyright (C) 2005-2014 Sergey A. Tachenov | 
 
 
 
 
 
 | 3 | 
  | 
 
 
 
 
 
 | 4 | 
 This file is part of QuaZIP test suite. | 
 
 
 
 
 
 | 5 | 
  | 
 
 
 
 
 
 | 6 | 
 QuaZIP is free software: you can redistribute it and/or modify | 
 
 
 
 
 
 | 7 | 
 it under the terms of the GNU Lesser General Public License as published by | 
 
 
 
 
 
 | 8 | 
 the Free Software Foundation, either version 2.1 of the License, or | 
 
 
 
 
 
 | 9 | 
 (at your option) any later version. | 
 
 
 
 
 
 | 10 | 
  | 
 
 
 
 
 
 | 11 | 
 QuaZIP is distributed in the hope that it will be useful, | 
 
 
 
 
 
 | 12 | 
 but WITHOUT ANY WARRANTY; without even the implied warranty of | 
 
 
 
 
 
 | 13 | 
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
 
 
 
 
 
 | 14 | 
 GNU Lesser General Public License for more details. | 
 
 
 
 
 
 | 15 | 
  | 
 
 
 
 
 
 | 16 | 
 You should have received a copy of the GNU Lesser General Public License | 
 
 
 
 
 
 | 17 | 
 along with QuaZIP.  If not, see <http://www.gnu.org/licenses/>. | 
 
 
 
 
 
 | 18 | 
  | 
 
 
 
 
 
 | 19 | 
 See COPYING file for the full LGPL text. | 
 
 
 
 
 
 | 20 | 
  | 
 
 
 
 
 
 | 21 | 
 Original ZIP package is copyrighted by Gilles Vollant and contributors, | 
 
 
 
 
 
 | 22 | 
 see quazip/(un)zip.h files for details. Basically it's the zlib license. | 
 
 
 
 
 
 | 23 | 
 */ | 
 
 
 
 
 
 | 24 | 
  | 
 
 
 
 
 
 | 25 | 
 #include "testquachecksum32.h" | 
 
 
 
 
 
 | 26 | 
  | 
 
 
 
 
 
 | 27 | 
 #include <quazip/quaadler32.h> | 
 
 
 
 
 
 | 28 | 
 #include <quazip/quacrc32.h> | 
 
 
 
 
 
 | 29 | 
  | 
 
 
 
 
 
 | 30 | 
 #include <QtTest/QtTest> | 
 
 
 
 
 
 | 31 | 
  | 
 
 
 
 
 
 | 32 | 
 void TestQuaChecksum32::calculate() | 
 
 
 
 
 
 | 33 | 
 { | 
 
 
 
 
 
 | 34 | 
     QuaCrc32 crc32; | 
 
 
 
 
 
 | 35 | 
     QCOMPARE(crc32.calculate("Wikipedia"), 0xADAAC02Eu); | 
 
 
 
 
 
 | 36 | 
     QuaAdler32 adler32; | 
 
 
 
 
 
 | 37 | 
     QCOMPARE(adler32.calculate("Wikipedia"), 0x11E60398u); | 
 
 
 
 
 
 | 38 | 
 } | 
 
 
 
 
 
 | 39 | 
  | 
 
 
 
 
 
 | 40 | 
 void TestQuaChecksum32::update() | 
 
 
 
 
 
 | 41 | 
 { | 
 
 
 
 
 
 | 42 | 
     QuaCrc32 crc32; | 
 
 
 
 
 
 | 43 | 
     crc32.update("Wiki"); | 
 
 
 
 
 
 | 44 | 
     crc32.update("pedia"); | 
 
 
 
 
 
 | 45 | 
     QCOMPARE(crc32.value(), 0xADAAC02Eu); | 
 
 
 
 
 
 | 46 | 
     QuaAdler32 adler32; | 
 
 
 
 
 
 | 47 | 
     adler32.update("Wiki"); | 
 
 
 
 
 
 | 48 | 
     adler32.update("pedia"); | 
 
 
 
 
 
 | 49 | 
     QCOMPARE(adler32.value(), 0x11E60398u); | 
 
 
 
 
 
 | 50 | 
 } |