From: Mark Wielaard <mark@klomp.org>
To: mauve-discuss@sources.redhat.com
Subject: New Adler32 test
Date: Thu, 01 Sep 2005 17:26:00 -0000 [thread overview]
Message-ID: <1125595411.4878.28.camel@localhost.localdomain> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 393 bytes --]
Hi,
Just added the following Adler32 tests.
I couldn't find official test vectors, but these results are for
gij/classpath (kaffe seems to have several bugs, patch submitted).
Please let me know if anybody know official test vectors for adler32.
2005-09-01 Mark Wielaard <mark@klomp.org>
* gnu/testlet/java/util/zip/Adler32/checksum.java: New test.
Committed,
Mark
[-- Attachment #1.2: checksum.java --]
[-- Type: text/x-java, Size: 2840 bytes --]
// Tags: JDK1.1
// Copyright (C) 2005 Mark J. Wielaard (mark@klomp.org)
// This file is part of Mauve.
// Mauve is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or (at your option)
// any later version.
// Mauve is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Mauve; see the file COPYING. If not, write to
// Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
// Boston, MA 02110-1301 USA.
package gnu.testlet.java.util.zip.Adler32;
import gnu.testlet.Testlet;
import gnu.testlet.TestHarness;
import java.util.zip.*;
public class checksum implements Testlet
{
// 1000, 6000, ..., 96000 arrays filled with value = (byte) index.
private final long[] someMore = new long[] { 486795068L,
1525910894L,
3543032800L,
2483946130L,
4150712693L,
3878123687L,
3650897945L,
1682829244L,
1842395054L,
460416992L,
3287492690L,
479453429L,
3960773095L,
2008242969L,
4130540683L,
1021367854L,
4065361952L,
2081116754L,
4033606837L,
1162071911L };
public void test(TestHarness harness)
{
byte[] bs;
for (int i = 0; i < 20; i++)
{
int length = i * 5000 + 1000;
bs = new byte[length];
for (int j = 0; j < bs.length; j++)
bs[j] = (byte) j;
test(harness, bs, someMore[i]);
}
}
private void test(TestHarness harness, byte[] bs, long result)
{
Adler32 adler = new Adler32();
harness.check(adler.getValue(), 1);
adler.update(bs);
harness.check(adler.getValue(), result);
adler.reset();
harness.check(adler.getValue(), 1);
for (int i = 0; i < bs.length; i += 1000)
adler.update(bs, i, 1000);
harness.check(adler.getValue(), result);
adler.reset();
harness.check(adler.getValue(), 1);
for (int i = 0; i < bs.length; i++)
adler.update(bs[i]);
harness.check(adler.getValue(), result);
adler.reset();
harness.check(adler.getValue(), 1);
for (int i = 0; i < 250; i++)
adler.update(bs[i]);
for (int i = 250; i < bs.length - 250; i += 250)
adler.update(bs, i, 250);
for (int i = bs.length - 250; i < bs.length; i++)
adler.update(bs[i]);
harness.check(adler.getValue(), result);
}
}
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
reply other threads:[~2005-09-01 17:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1125595411.4878.28.camel@localhost.localdomain \
--to=mark@klomp.org \
--cc=mauve-discuss@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).