We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stakwork Run
File: /tmp/stakwork/sphinx-tribes/db/metrics.go
package metrics import ( "math" "testing" "github.com/stretchr/testify/assert" ) // Assume SecondsToDateConversion is defined somewhere in the package const SecondsToDateConversion = 86400 // Example value for seconds in a day func TestCalculateAverageDays(t *testing.T) { tests := []struct { name string paidCount int64 paidSum uint expected uint }{ { name: "Standard Input", paidCount: 10, paidSum: 1000, expected: uint(math.Round(float64(1000/10) / float64(SecondsToDateConversion))), }, { name: "Zero Paid Count", paidCount: 0, paidSum: 1000, expected: 0, }, { name: "Zero Paid Sum", paidCount: 10, paidSum: 0, expected: 0, }, { name: "Both Zero", paidCount: 0, paidSum: 0, expected: 0, }, { name: "Minimum Positive Values", paidCount: 1, paidSum: 1, expected: 0, }, { name: "Negative Paid Count", paidCount: -1, paidSum: 1000, expected: 0, }, { name: "Negative Paid Sum", paidCount: 10, paidSum: 0, // Negative values are not possible for uint, so set to 0 expected: 0, }, { name: "Large Paid Count and Sum", paidCount: 1000000, paidSum: 1000000000, expected: uint(math.Round(float64(1000000000/1000000) / float64(SecondsToDateConversion))), }, { name: "Paid Count Greater than Paid Sum", paidCount: 1000, paidSum: 500, expected: 0, }, { name: "Paid Sum Exactly Divisible by Paid Count", paidCount: 5, paidSum: 100, expected: uint(math.Round(float64(100/5) / float64(SecondsToDateConversion))), }, { name: "Paid Sum Not Divisible by Paid Count", paidCount: 3, paidSum: 100, expected: uint(math.Round(float64(100/3) / float64(SecondsToDateConversion))), }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { result := CalculateAverageDays(tt.paidCount, tt.paidSum) assert.Equal(t, tt.expected, result) }) } }
The text was updated successfully, but these errors were encountered:
@tomsmith8 is that available for work? assign me
Sorry, something went wrong.
@tomsmith8 Please assign me?
@tomsmith8 assign me?
MahtabBukhari
Successfully merging a pull request may close this issue.
Unit Test Coverage for "CalculateAverageDays"
Stakwork Run
Unit Test Code
File: /tmp/stakwork/sphinx-tribes/db/metrics.go
The text was updated successfully, but these errors were encountered: