File: electricconstant_test.go

package info (click to toggle)
golang-gonum-v1-gonum 0.15.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 18,792 kB
  • sloc: asm: 6,252; fortran: 5,271; sh: 377; ruby: 211; makefile: 98
file content (33 lines) | stat: -rw-r--r-- 1,032 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Code generated by "go generate gonum.org/v1/gonum/unit/constant”; DO NOT EDIT.

// Copyright ©2019 The Gonum Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package constant

import (
	"fmt"
	"testing"
)

func TestElectricConstantFormat(t *testing.T) {
	t.Parallel()
	for _, test := range []struct {
		format string
		want   string
	}{
		{"%v", "8.854187817620389e-12 A^2 s^4 kg^-1 m^-3"},
		{"%.1v", "9e-12 A^2 s^4 kg^-1 m^-3"},
		{"%50.1v", "                          9e-12 A^2 s^4 kg^-1 m^-3"},
		{"%50v", "          8.854187817620389e-12 A^2 s^4 kg^-1 m^-3"},
		{"%1v", "8.854187817620389e-12 A^2 s^4 kg^-1 m^-3"},
		{"%#v", "constant.electricConstantUnits(8.854187817620389e-12)"},
		{"%s", "%!s(constant.electricConstantUnits=8.854187817620389e-12 A^2 s^4 kg^-1 m^-3)"},
	} {
		got := fmt.Sprintf(test.format, ElectricConstant)
		if got != test.want {
			t.Errorf("Format %q: got: %q want: %q", test.format, got, test.want)
		}
	}
}