Source file src/crypto/boring/boring_test.go

     1  // Copyright 2020 The Go Authors. 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  //go:build boringcrypto
     6  
     7  package boring_test
     8  
     9  import (
    10  	"crypto/boring"
    11  	"runtime"
    12  	"testing"
    13  )
    14  
    15  func TestEnabled(t *testing.T) {
    16  	supportedPlatform := runtime.GOOS == "linux" && (runtime.GOARCH == "amd64" || runtime.GOARCH == "arm64")
    17  	if supportedPlatform && !boring.Enabled() {
    18  		t.Error("Enabled returned false on a supported platform")
    19  	} else if !supportedPlatform && boring.Enabled() {
    20  		t.Error("Enabled returned true on an unsupported platform")
    21  	}
    22  }
    23  

View as plain text