...

Source file src/github.com/Microsoft/hcsshim/internal/jobcontainers/cpurate_test.go

Documentation: github.com/Microsoft/hcsshim/internal/jobcontainers

     1  //go:build windows
     2  
     3  package jobcontainers
     4  
     5  import (
     6  	"testing"
     7  )
     8  
     9  func assertEqual(t *testing.T, a uint32, b uint32) {
    10  	t.Helper()
    11  	if a != b {
    12  		t.Fatalf("%d != %d", a, b)
    13  	}
    14  }
    15  
    16  func TestJobCPURate(t *testing.T) {
    17  	rate := calculateJobCPURate(10, 1)
    18  	assertEqual(t, rate, 1000)
    19  
    20  	rate = calculateJobCPURate(10, 5)
    21  	assertEqual(t, rate, 5000)
    22  
    23  	rate = calculateJobCPURate(20, 5)
    24  	assertEqual(t, rate, 2500)
    25  
    26  	rate = calculateJobCPURate(1, 1)
    27  	assertEqual(t, rate, 10000)
    28  
    29  	rate = calculateJobCPURate(1, 0)
    30  	assertEqual(t, rate, 1)
    31  }
    32  

View as plain text