1//  Copyright (c) 2018 Couchbase, Inc.
2//  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
3//  except in compliance with the License. You may obtain a copy of the License at
4//    http://www.apache.org/licenses/LICENSE-2.0
5//  Unless required by applicable law or agreed to in writing, software distributed under the
6//  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
7//  either express or implied. See the License for the specific language governing permissions
8//  and limitations under the License.
9
10package util
11
12import (
13	"testing"
14)
15
16func TestSeaHash(t *testing.T) {
17	s := SeaHashSum64([]byte("to be or not to be"))
18
19	if s != 0x1b993a826f4ae575 {
20		t.Errorf("Expected 0x1b993a826f4ae575, got %x", s)
21	}
22
23	s = SeaHashSum64([]byte(""))
24
25	if s != 0xc920ca43256fdcb9 {
26		t.Errorf("Expected 0xc920ca43256fdcb9, got %x", s)
27	}
28
29	s = SeaHashSum64([]byte("couchbase"))
30
31	if s != 0x4e5d5535342df6ef {
32		t.Errorf("Expected 0x, got %x4e5d5535342df6ef", s)
33	}
34
35	s = SeaHashSum64([]byte("12345678"))
36
37	if s != 0x79476d25d4c6dfc4 {
38		t.Errorf("Expected 0x79476d25d4c6dfc4, got %x", s)
39	}
40
41	s = SeaHashSum64([]byte("Couchbase N1QL"))
42
43	if s != 0x682b2cc0145769e3 {
44		t.Errorf("Expected 0x682b2cc0145769e3, got %x", s)
45	}
46}
47