// Path: ohc-core/src/main/java/org/caffinitas/ohc/HashAlgorithm.java
// public enum HashAlgorithm
// {
//     MURMUR3,
// 
//     CRC32,
// 
//     CRC32C,
// 
//     XX
// }
// 
// Path: ohc-core/src/main/java/org/caffinitas/ohc/util/ByteBufferCompat.java
// public static void byteBufferFlip(ByteBuffer byteBuffer) {
//     byteBufferAccess.flip(byteBuffer);
// }


import java.nio.ByteBuffer;
import com.google.common.hash.Hasher;
import com.google.common.hash.Hashing;
import org.caffinitas.ohc.HashAlgorithm;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import static org.caffinitas.ohc.util.ByteBufferCompat.byteBufferFlip;
import static org.testng.Assert.assertEquals;
/*
 *      Copyright (C) 2014 Robert Stupp, Koeln, Germany, robert-stupp.de
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */
package org.caffinitas.ohc.chunked;





public class KeyBufferTest
{
    @AfterMethod(alwaysRun = true)
    public void deinit()
    {
        Uns.clearUnsDebugForTest();
    }

    @Test
    public void testHashFinish() throws Exception
    {
        byte[] ref = TestUtils.randomBytes(10);
        ByteBuffer buf = ByteBuffer.allocate(12);
        buf.put((byte)(42 & 0xff));
        buf.put(ref);
        buf.put((byte)(0xf0 & 0xff));
        byteBufferFlip(buf);
// Path: ohc-core/src/main/java/org/caffinitas/ohc/HashAlgorithm.java
// public enum HashAlgorithm
// {
//     MURMUR3,
// 
//     CRC32,
// 
//     CRC32C,
// 
//     XX
// }
// 
// Path: ohc-core/src/main/java/org/caffinitas/ohc/util/ByteBufferCompat.java
// public static void byteBufferFlip(ByteBuffer byteBuffer) {
//     byteBufferAccess.flip(byteBuffer);
// }


// Path: ohc-core/src/test/java/org/caffinitas/ohc/chunked/KeyBufferTest.java
import java.nio.ByteBuffer;
import com.google.common.hash.Hasher;
import com.google.common.hash.Hashing;
import org.caffinitas.ohc.HashAlgorithm;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import static org.caffinitas.ohc.util.ByteBufferCompat.byteBufferFlip;
import static org.testng.Assert.assertEquals;

/*
 *      Copyright (C) 2014 Robert Stupp, Koeln, Germany, robert-stupp.de
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */
package org.caffinitas.ohc.chunked;





public class KeyBufferTest
{
    @AfterMethod(alwaysRun = true)
    public void deinit()
    {
        Uns.clearUnsDebugForTest();
    }

    @Test
    public void testHashFinish() throws Exception
    {
        byte[] ref = TestUtils.randomBytes(10);
        ByteBuffer buf = ByteBuffer.allocate(12);
        buf.put((byte)(42 & 0xff));
        buf.put(ref);
        buf.put((byte)(0xf0 & 0xff));
        byteBufferFlip(buf);
        KeyBuffer out = new KeyBuffer(buf).finish(org.caffinitas.ohc.chunked.Hasher.create(HashAlgorithm.MURMUR3));