This repository has been archived by the owner on Sep 12, 2023. It is now read-only.
forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: fix version comparison for go1.10 and beyond (ethereum#15781)
- Loading branch information
Showing
3 changed files
with
92 additions
and
6 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,54 @@ | ||
package arg_parser | ||
import "testing" | ||
import "bytes" | ||
import "fmt" | ||
|
||
// single positive integer (big endian) | ||
func ExampleA(){ | ||
var arg_parser arg_parser_t | ||
var f, d []byte | ||
var buf bytes.Buffer; | ||
|
||
f = make([]byte, 1, 1) | ||
d = make([]byte, 70, 70) | ||
f[0] = INT | ||
for i:=0; i<70; i++ { d[i] = uint8(0) } | ||
d[31] = uint8(72) // 32-byte big endian | ||
arg_parser.parse_entry_point(f, d, &buf) | ||
fmt.Println(buf.String()) | ||
// Output: [72] | ||
} | ||
|
||
// single positive integer (big endian) | ||
func TestB(t *testing.T){ | ||
var arg_parser arg_parser_t | ||
var f, d []byte | ||
var buf bytes.Buffer; | ||
|
||
f = make([]byte, 1, 1) | ||
d = make([]byte, 70, 70) | ||
f[0] = INT | ||
for i:=0; i<70; i++ { d[i] = uint8(0) } | ||
a:= -72 | ||
d[31] = byte(a) // 32-byte big endian | ||
arg_parser.parse_entry_point(f, d, &buf) | ||
} | ||
|
||
// a int and a bool | ||
func ExampleC(){ | ||
var arg_parser arg_parser_t | ||
var f, d []byte | ||
var buf bytes.Buffer; | ||
|
||
f = make([]byte, 2, 2) | ||
d = make([]byte, 70, 70) | ||
f[0] = INT | ||
f[1] = BOOL | ||
for i:=0; i<70; i++ { d[i] = uint8(0) } | ||
d[31] = uint8(72) // 32-byte big endian | ||
arg_parser.parse_entry_point(f, d, &buf) | ||
fmt.Println(buf.String()) | ||
|
||
// Output: [72,false] | ||
} | ||
|
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