-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #243 from eurofurence/issue-239-multi-packages
improve package encoding in DB to support large number of packages and larger counts
- Loading branch information
Showing
13 changed files
with
297 additions
and
68 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
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 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package attendeesrv | ||
|
||
import ( | ||
"github.com/eurofurence/reg-attendee-service/internal/repository/config" | ||
"github.com/stretchr/testify/require" | ||
"testing" | ||
) | ||
|
||
var tstChoiceConfig = map[string]config.ChoiceConfig{ | ||
"a": { | ||
MaxCount: 0, // interpreted as 1 | ||
}, | ||
"b": { | ||
MaxCount: 1, | ||
}, | ||
"c": { | ||
MaxCount: 4, | ||
}, | ||
} | ||
|
||
func TestChoiceStrToMap_Flags(t *testing.T) { | ||
actual := choiceStrToMap(",a,b,", tstChoiceConfig) | ||
expected := map[string]int{ | ||
"a": 1, | ||
"b": 1, | ||
"c": 0, | ||
} | ||
require.EqualValues(t, expected, actual) | ||
} | ||
|
||
func TestChoiceStrToMap_Packages(t *testing.T) { | ||
actual := choiceStrToMap(",a:1,c,b,c:2,", tstChoiceConfig) | ||
expected := map[string]int{ | ||
"a": 1, | ||
"b": 1, | ||
"c": 3, | ||
} | ||
require.EqualValues(t, expected, actual) | ||
} |
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
Oops, something went wrong.