forked from TrueCloudLab/frostfs-node
[#280] ir: Add alphabet processor unit tests
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
53693071de
commit
e89fa7f69f
4 changed files with 316 additions and 15 deletions
|
@ -104,13 +104,13 @@ func (l GlagoliticLetter) String() string {
|
|||
return "unknown"
|
||||
}
|
||||
|
||||
type alphabetContracts map[GlagoliticLetter]util.Uint160
|
||||
type AlphabetContracts map[GlagoliticLetter]util.Uint160
|
||||
|
||||
func newAlphabetContracts() alphabetContracts {
|
||||
func NewAlphabetContracts() AlphabetContracts {
|
||||
return make(map[GlagoliticLetter]util.Uint160, lastLetterNum)
|
||||
}
|
||||
|
||||
func (a alphabetContracts) GetByIndex(ind int) (util.Uint160, bool) {
|
||||
func (a AlphabetContracts) GetByIndex(ind int) (util.Uint160, bool) {
|
||||
if ind < 0 || ind >= int(lastLetterNum) {
|
||||
return util.Uint160{}, false
|
||||
}
|
||||
|
@ -120,16 +120,16 @@ func (a alphabetContracts) GetByIndex(ind int) (util.Uint160, bool) {
|
|||
return contract, ok
|
||||
}
|
||||
|
||||
func (a alphabetContracts) indexOutOfRange(ind int) bool {
|
||||
func (a AlphabetContracts) indexOutOfRange(ind int) bool {
|
||||
return ind < 0 && ind >= len(a)
|
||||
}
|
||||
|
||||
func (a alphabetContracts) iterate(f func(GlagoliticLetter, util.Uint160)) {
|
||||
func (a AlphabetContracts) iterate(f func(GlagoliticLetter, util.Uint160)) {
|
||||
for letter, contract := range a {
|
||||
f(letter, contract)
|
||||
}
|
||||
}
|
||||
|
||||
func (a *alphabetContracts) set(l GlagoliticLetter, h util.Uint160) {
|
||||
func (a *AlphabetContracts) set(l GlagoliticLetter, h util.Uint160) {
|
||||
(*a)[l] = h
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue