package docker //nolint:testpackage // tests unexported cpuLimitToNanoCPUs import ( "testing" ) func TestCpuLimitToNanoCPUs(t *testing.T) { t.Parallel() tests := []struct { name string cpuLimit float64 expected int64 }{ {"one core", 1.0, 1_000_000_000}, {"half core", 0.5, 500_000_000}, {"two cores", 2.0, 2_000_000_000}, {"quarter core", 0.25, 250_000_000}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { t.Parallel() got := cpuLimitToNanoCPUs(tt.cpuLimit) if got != tt.expected { t.Errorf("cpuLimitToNanoCPUs(%v) = %d, want %d", tt.cpuLimit, got, tt.expected) } }) } }