-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pass 0 to let go parse the base value (#229)
- Loading branch information
Showing
8 changed files
with
202 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package example | ||
|
||
//go:generate ../bin/go-enum --forcelower -b example | ||
|
||
/* | ||
ENUM( | ||
B3 = 03 | ||
B4 = 04 | ||
B5 = 5 | ||
B6 = 0b110 | ||
B7 = 0b111 | ||
B8 = 0x08 | ||
B9 = 0x09 | ||
B10 = 0x0B | ||
B11 = 0x2B | ||
) | ||
*/ | ||
type DiffBase int |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,60 @@ | ||
//go:build example | ||
// +build example | ||
|
||
package example | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestDiffBase(t *testing.T) { | ||
tests := map[string]struct { | ||
actual int | ||
expected DiffBase | ||
}{ | ||
"DiffBaseB3": { | ||
actual: 3, | ||
expected: DiffBaseB3, | ||
}, | ||
"DiffBaseB4": { | ||
actual: 4, | ||
expected: DiffBaseB4, | ||
}, | ||
"DiffBaseB5": { | ||
actual: 5, | ||
expected: DiffBaseB5, | ||
}, | ||
"DiffBaseB6": { | ||
actual: 6, | ||
expected: DiffBaseB6, | ||
}, | ||
"DiffBaseB7": { | ||
actual: 7, | ||
expected: DiffBaseB7, | ||
}, | ||
"DiffBaseB8": { | ||
actual: 8, | ||
expected: DiffBaseB8, | ||
}, | ||
"DiffBaseB9": { | ||
actual: 9, | ||
expected: DiffBaseB9, | ||
}, | ||
"DiffBaseB10": { | ||
actual: 11, | ||
expected: DiffBaseB10, | ||
}, | ||
"DiffBaseB11": { | ||
actual: 43, | ||
expected: DiffBaseB11, | ||
}, | ||
} | ||
|
||
for name, tc := range tests { | ||
t.Run(name, func(t *testing.T) { | ||
assert.Equal(t, int(tc.expected), tc.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
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