summaryrefslogtreecommitdiffstats
path: root/cmd/binapi-generator
diff options
context:
space:
mode:
authorVladimir Lavor <vlavor@cisco.com>2019-01-02 12:02:33 +0100
committerVladimir Lavor <vlavor@cisco.com>2019-01-02 12:02:33 +0100
commit3ef6f210edcf7dd753733d46ec3f2dd5dc795b61 (patch)
tree565e3f89ca34cf0ac21e8269e1a66fee1603678d /cmd/binapi-generator
parent5f1917fd11e8562ef4094b7ce3a89af66ace5792 (diff)
added support for string type
Change-Id: I2de04fba137004d1d7148ae910e9ccbd47589611 Signed-off-by: Vladimir Lavor <vlavor@cisco.com>
Diffstat (limited to 'cmd/binapi-generator')
-rw-r--r--cmd/binapi-generator/definitions.go21
-rw-r--r--cmd/binapi-generator/generate_test.go3
2 files changed, 11 insertions, 13 deletions
diff --git a/cmd/binapi-generator/definitions.go b/cmd/binapi-generator/definitions.go
index 0176278..b8c3393 100644
--- a/cmd/binapi-generator/definitions.go
+++ b/cmd/binapi-generator/definitions.go
@@ -34,16 +34,17 @@ func getBinapiTypeSize(binapiType string) int {
// binapiTypes is a set of types used VPP binary API for translation to Go types
var binapiTypes = map[string]string{
- "bool": "bool",
- "u8": "uint8",
- "i8": "int8",
- "u16": "uint16",
- "i16": "int16",
- "u32": "uint32",
- "i32": "int32",
- "u64": "uint64",
- "i64": "int64",
- "f64": "float64",
+ "bool": "bool",
+ "u8": "uint8",
+ "i8": "int8",
+ "u16": "uint16",
+ "i16": "int16",
+ "u32": "uint32",
+ "i32": "int32",
+ "u64": "uint64",
+ "i64": "int64",
+ "f64": "float64",
+ "string": "string",
}
func usesInitialism(s string) string {
diff --git a/cmd/binapi-generator/generate_test.go b/cmd/binapi-generator/generate_test.go
index 4b06733..bac5b51 100644
--- a/cmd/binapi-generator/generate_test.go
+++ b/cmd/binapi-generator/generate_test.go
@@ -16,7 +16,6 @@ package main
import (
"bufio"
- "bytes"
"os"
"testing"
@@ -139,7 +138,6 @@ func TestGeneratePackage(t *testing.T) {
// prepare input/output output files
inputData, err := readFile("testdata/ip.api.json")
Expect(err).ShouldNot(HaveOccurred())
- testCtx.inputBuff = bytes.NewBuffer(inputData)
jsonRoot, err := parseJSON(inputData)
Expect(err).ShouldNot(HaveOccurred())
testCtx.packageData, err = parsePackage(testCtx, jsonRoot)
@@ -165,7 +163,6 @@ func TestGenerateMessageType(t *testing.T) {
// prepare input/output output files
inputData, err := readFile("testdata/ip.api.json")
Expect(err).ShouldNot(HaveOccurred())
- testCtx.inputBuff = bytes.NewBuffer(inputData)
jsonRoot, err := parseJSON(inputData)
Expect(err).ShouldNot(HaveOccurred())
outDir := "test_output_directory"