git.prognetwork.ru/x0r/utls@v1.3.3/u_common_test.go (about)

     1  // Copyright 2017 Google Inc. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package tls
     6  
     7  import (
     8  	"testing"
     9  )
    10  
    11  func TestUTLSIsGrease(t *testing.T) {
    12  
    13  	var testMap = []struct {
    14  		version  uint16
    15  		isGREASE bool
    16  	}{
    17  		{0x0a0a, true},
    18  		{0x1a1a, true},
    19  		{0x2a1a, false},
    20  		{0x2a2a, true},
    21  		{0x1234, false},
    22  		{0x1a2a, false},
    23  		{0xdeed, false},
    24  		{0xb1b1, false},
    25  		{0x0b0b, false},
    26  	}
    27  
    28  	for _, testCase := range testMap {
    29  		if isGREASEUint16(testCase.version) != testCase.isGREASE {
    30  			t.Errorf("misidentified GREASE: testing %x, isGREASE: %v", testCase.version, isGREASEUint16(testCase.version))
    31  		}
    32  	}
    33  }