-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1.3.0] Add Missing Tests [API-1112] (#703)
* add missing tests * add http client tests * try enabling TestClient_AddDistributedObjectListener * exclude unused codec files from test coverage * exclude unused codec files from test coverage * refactor test structs for field alignment check * test http client retry mechanism * fix bad merge * address review comments * refactor index variables "ind" to "i" * field reordering for "fieldalignment" * undo wrong file remove
- Loading branch information
1 parent
a2d404d
commit 5ff41fe
Showing
8 changed files
with
384 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package aggregate | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
) | ||
|
||
func TestMakeString(t *testing.T) { | ||
tcs := []struct { | ||
name string | ||
attrPath string | ||
want string | ||
}{ | ||
{ | ||
name: "test", | ||
attrPath: "attribute", | ||
want: "test(attribute)", | ||
}, | ||
{ | ||
name: "", | ||
attrPath: "", | ||
want: "()", | ||
}, | ||
} | ||
for i, tt := range tcs { | ||
t.Run(fmt.Sprintf("makeString case: %d", i), func(t *testing.T) { | ||
if got := makeString(tt.name, tt.attrPath); got != tt.want { | ||
t.Errorf("makeString() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
func TestAggStringer(t *testing.T) { | ||
tcs := []struct { | ||
aggInstance fmt.Stringer | ||
want string | ||
}{ | ||
{ | ||
aggInstance: Count("attribute"), | ||
want: "Count(attribute)", | ||
}, | ||
{ | ||
aggInstance: DistinctValues("attribute"), | ||
want: "DistinctValues(attribute)", | ||
}, | ||
{ | ||
aggInstance: DoubleSum("attribute"), | ||
want: "DoubleSum(attribute)", | ||
}, | ||
{ | ||
aggInstance: DoubleAverage("attribute"), | ||
want: "DoubleAverage(attribute)", | ||
}, | ||
{ | ||
aggInstance: IntSum("attribute"), | ||
want: "IntSum(attribute)", | ||
}, | ||
{ | ||
aggInstance: IntAverage("attribute"), | ||
want: "IntAverage(attribute)", | ||
}, | ||
{ | ||
aggInstance: LongSum("attribute"), | ||
want: "LongSum(attribute)", | ||
}, | ||
{ | ||
aggInstance: LongAverage("attribute"), | ||
want: "LongAverage(attribute)", | ||
}, | ||
{ | ||
aggInstance: Max("attribute"), | ||
want: "Max(attribute)", | ||
}, | ||
|
||
{ | ||
aggInstance: Min("attribute"), | ||
want: "Min(attribute)", | ||
}, | ||
} | ||
for i, tt := range tcs { | ||
t.Run(fmt.Sprintf("makeString case: %d", i), func(t *testing.T) { | ||
if got := tt.aggInstance.String(); got != tt.want { | ||
t.Errorf("String() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.