t.Errorf("ByteFromProcFileData() gotValue = %v, want %v", gotValue, tt.wantValue)
** Copyright (C) 2001-2023 Zabbix SIA
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
func BenchmarkReadAll(b *testing.B) {
for i := 0; i < b.N; i++ {
_, _ = ReadAll("/proc/self/stat")
func Test_byteFromProcFileData(t *testing.T) {
{"+kB", args{testData, "VmPeak"}, 6032 * 1024, true, false},
{"+mB", args{testData, "VmHWM"}, 456 * 1024 * 1024, true, false},
{"+GB", args{testData, "VmRSS"}, 456 * 1024 * 1024 * 1024, true, false},
{"+TB", args{testData, "VmData"}, 376 * 1024 * 1024 * 1024 * 1024, true, false},
{"-malformed_line", args{testData, "b"}, 0, false, false},
{"-incorrect_value", args{testData, "fail"}, 0, false, true},