Fix creating filesystem structure
This commit is contained in:
parent
af72e66f8b
commit
6f5f3d6407
@ -27,7 +27,7 @@ func NewFilesystem(args []string) (procPtr *Filesystem, err error) {
|
|||||||
// TODO: add error checking
|
// TODO: add error checking
|
||||||
size, _ := strconv.Atoi(args[1])
|
size, _ := strconv.Atoi(args[1])
|
||||||
used, _ := strconv.Atoi(args[2])
|
used, _ := strconv.Atoi(args[2])
|
||||||
available, _ := strconv.Atoi(args[2])
|
available, _ := strconv.Atoi(args[3])
|
||||||
procPtr = &Filesystem{
|
procPtr = &Filesystem{
|
||||||
args[0], size, used, available, args[4]}
|
args[0], size, used, available, args[4]}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ func TestNewFilesystem(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Passing 5 strings should not raise an error")
|
t.Errorf("Passing 5 strings should not raise an error")
|
||||||
}
|
}
|
||||||
expected := Filesystem{"1", "2", "3", "4", "5"}
|
expected := Filesystem{"1", 2, 3, 4, "5"}
|
||||||
actual := *proc
|
actual := *proc
|
||||||
if expected != actual {
|
if expected != actual {
|
||||||
t.Errorf("Filesystem was incorrectly generated:\n%s != %s", expected, actual)
|
t.Errorf("Filesystem was incorrectly generated:\n%s != %s", expected, actual)
|
||||||
|
Reference in New Issue
Block a user