Tests and fixes for dereferencing tags in Repository.resolve()
[egit/fonseca.git] / org.spearce.jgit.test / tst / org / spearce / jgit / lib / PackIndexV2Test.java
blobd95937c47bf1136896c8d6471897f66449aeacf7
1 /*
2 * Copyright (C) 2008, Marek Zawirski <marek.zawirski@gmail.com>
4 * All rights reserved.
6 * Redistribution and use in source and binary forms, with or
7 * without modification, are permitted provided that the following
8 * conditions are met:
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * - Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
18 * - Neither the name of the Git Development Community nor the
19 * names of its contributors may be used to endorse or promote
20 * products derived from this software without specific prior
21 * written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
24 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
25 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
28 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
33 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
35 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 package org.spearce.jgit.lib;
40 import java.io.File;
42 import org.spearce.jgit.errors.MissingObjectException;
43 import org.spearce.jgit.util.JGitTestUtil;
45 public class PackIndexV2Test extends PackIndexTest {
46 @Override
47 public File getFileForPack34be9032() {
48 return JGitTestUtil.getTestResourceFile(
49 "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idxV2");
52 @Override
53 public File getFileForPackdf2982f28() {
54 return JGitTestUtil.getTestResourceFile(
55 "pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idxV2");
58 /**
59 * Verify CRC32 indexing.
61 * @throws UnsupportedOperationException
62 * @throws MissingObjectException
64 @Override
65 public void testCRC32() throws MissingObjectException,
66 UnsupportedOperationException {
67 assertTrue(smallIdx.hasCRC32Support());
68 assertEquals(0x00000000C2B64258l, smallIdx.findCRC32(ObjectId
69 .fromString("4b825dc642cb6eb9a060e54bf8d69288fbee4904")));
70 assertEquals(0x0000000072AD57C2l, smallIdx.findCRC32(ObjectId
71 .fromString("540a36d136cf413e4b064c2b0e0a4db60f77feab")));
72 assertEquals(0x00000000FF10A479l, smallIdx.findCRC32(ObjectId
73 .fromString("5b6e7c66c276e7610d4a73c70ec1a1f7c1003259")));
74 assertEquals(0x0000000034B27DDCl, smallIdx.findCRC32(ObjectId
75 .fromString("6ff87c4664981e4397625791c8ea3bbb5f2279a3")));
76 assertEquals(0x000000004743F1E4l, smallIdx.findCRC32(ObjectId
77 .fromString("82c6b885ff600be425b4ea96dee75dca255b69e7")));
78 assertEquals(0x00000000640B358Bl, smallIdx.findCRC32(ObjectId
79 .fromString("902d5476fa249b7abc9d84c611577a81381f0327")));
80 assertEquals(0x000000002A17CB5El, smallIdx.findCRC32(ObjectId
81 .fromString("aabf2ffaec9b497f0950352b3e582d73035c2035")));
82 assertEquals(0x000000000B3B5BA6l, smallIdx.findCRC32(ObjectId
83 .fromString("c59759f143fb1fe21c197981df75a7ee00290799")));