X7ROOT File Manager
Current Path:
/opt/golang/1.17.2/src/strconv
opt
/
golang
/
1.17.2
/
src
/
strconv
/
📁
..
📄
atob.go
(974 B)
📄
atob_test.go
(1.89 KB)
📄
atoc.go
(3.02 KB)
📄
atoc_test.go
(6.83 KB)
📄
atof.go
(15.76 KB)
📄
atof_test.go
(23.6 KB)
📄
atoi.go
(7.61 KB)
📄
atoi_test.go
(17.04 KB)
📄
bytealg.go
(419 B)
📄
bytealg_bootstrap.go
(430 B)
📄
ctoa.go
(1 KB)
📄
ctoa_test.go
(1.45 KB)
📄
decimal.go
(11.03 KB)
📄
decimal_test.go
(3.01 KB)
📄
doc.go
(1.87 KB)
📄
eisel_lemire.go
(41.39 KB)
📄
example_test.go
(8.18 KB)
📄
export_test.go
(240 B)
📄
fp_test.go
(2.91 KB)
📄
ftoa.go
(13.97 KB)
📄
ftoa_test.go
(9.24 KB)
📄
ftoaryu.go
(15.69 KB)
📄
ftoaryu_test.go
(759 B)
📄
internal_test.go
(618 B)
📄
isprint.go
(11.06 KB)
📄
itoa.go
(5.3 KB)
📄
itoa_test.go
(5.67 KB)
📄
makeisprint.go
(4.83 KB)
📄
quote.go
(16.59 KB)
📄
quote_test.go
(9.46 KB)
📄
strconv_test.go
(2.86 KB)
📁
testdata
Editing: atob_test.go
// Copyright 2009 The Go 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 strconv_test import ( "bytes" . "strconv" "testing" ) type atobTest struct { in string out bool err error } var atobtests = []atobTest{ {"", false, ErrSyntax}, {"asdf", false, ErrSyntax}, {"0", false, nil}, {"f", false, nil}, {"F", false, nil}, {"FALSE", false, nil}, {"false", false, nil}, {"False", false, nil}, {"1", true, nil}, {"t", true, nil}, {"T", true, nil}, {"TRUE", true, nil}, {"true", true, nil}, {"True", true, nil}, } func TestParseBool(t *testing.T) { for _, test := range atobtests { b, e := ParseBool(test.in) if test.err != nil { // expect an error if e == nil { t.Errorf("%s: expected %s but got nil", test.in, test.err) } else { // NumError assertion must succeed; it's the only thing we return. if test.err != e.(*NumError).Err { t.Errorf("%s: expected %s but got %s", test.in, test.err, e) } } } else { if e != nil { t.Errorf("%s: expected no error but got %s", test.in, e) } if b != test.out { t.Errorf("%s: expected %t but got %t", test.in, test.out, b) } } } } var boolString = map[bool]string{ true: "true", false: "false", } func TestFormatBool(t *testing.T) { for b, s := range boolString { if f := FormatBool(b); f != s { t.Errorf(`FormatBool(%v): expected %q but got %q`, b, s, f) } } } type appendBoolTest struct { b bool in []byte out []byte } var appendBoolTests = []appendBoolTest{ {true, []byte("foo "), []byte("foo true")}, {false, []byte("foo "), []byte("foo false")}, } func TestAppendBool(t *testing.T) { for _, test := range appendBoolTests { b := AppendBool(test.in, test.b) if !bytes.Equal(b, test.out) { t.Errorf("AppendBool(%q, %v): expected %q but got %q", test.in, test.b, test.out, b) } } }
Upload File
Create Folder