Bird Watcher exercise, 3rd test case is wrong

In the third function, in test cases by itself there are errors please fix it.
Errors explanation: in some test cases it wants ints instead of slice of ints:

birdCounts []int
want       int

In other cases it is passed as exactly as required:

birdCounts []int
want       []int

it wants a slice of integer (which I provided as birdCounts as it is required).
Please fix it, thank you in advance.

Some functions are expected to return a single int (the first two) while others are expected to return a slice (the third). The tests align with what the functions ought to return: the first two tests expect an int and the third wants a slice. Are you seeing something different?

Which line number in the test file are you looking at? go/bird_watcher_test.go at main · exercism/go · GitHub

package birdwatcher
1)
// TotalBirdCount return the total bird count by summing
// the individual day’s counts.

// BirdsInWeek returns the total bird count by summing
// only the items belonging to the given week.
3)
// FixBirdCountLog returns the bird counts after correcting
// the bird counts for alternate days.

please test my solution, soon I am planning to delete my solution.

Instead of assuming the test case that several other students, myself included, have solved without issues is wrong. Take a closer look at your code instead.

It can pass the test with a small fix, here’s a hint; consider the difference between a package level vs. a function level variable.

1 Like

Note, you can use codeblocks to share code and make it much easier to read.

Type this.

```go
var sum int
func TotalBirdCount(birdsPerDay []int) int {
for i := 0; i < len(birdsPerDay); i++{
bird := birdsPerDay[i]
sum += bird
}
return sum
}
```

And we see this.

var sum int
func TotalBirdCount(birdsPerDay []int) int {
    for i := 0; i < len(birdsPerDay); i++{
        bird := birdsPerDay[i]
        sum += bird
    }
    return sum
}

Big thanks you for the direction to my error

Yes it helped, Thank you very much.