-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2175803
commit 670922e
Showing
7 changed files
with
123 additions
and
46 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,48 @@ | ||
package schema | ||
|
||
import "testing" | ||
|
||
func TestJSONName(t *testing.T) { | ||
tests := []struct { | ||
input string | ||
expected string | ||
}{ | ||
{ | ||
input: "Vehicle.CurrentLocation.Altitude", | ||
expected: "currentLocationAltitude", | ||
}, | ||
{ | ||
input: "Vechicle.DIMO.Source", | ||
expected: "dimoSource", | ||
}, | ||
{ | ||
input: "Vehicle.DIMO.WPAState", | ||
expected: "dimoWPAState", | ||
}, | ||
{ | ||
input: "Vehicle.DIMO.Aftemarket.HDOP", | ||
expected: "dimoAftemarketHDOP", | ||
}, | ||
{ | ||
input: "Vehicle.DIMO.Aftemarket.WPAState", | ||
expected: "dimoAftemarketWPAState", | ||
}, | ||
{ | ||
input: "Vehicle.Powertrain.CombustionEngine.ECT", | ||
expected: "powertrainCombustionEngineECT", | ||
}, | ||
{ | ||
input: "Vehicle.Powertrain.CombustionEngine.Tps", | ||
expected: "powertrainCombustionEngineTps", | ||
}, | ||
} | ||
|
||
for _, test := range tests { | ||
t.Run(test.input, func(t *testing.T) { | ||
result := jsonName(test.input) | ||
if result != test.expected { | ||
t.Errorf("Unexpected result. Expected: %s, Got: %s", test.expected, result) | ||
} | ||
}) | ||
} | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.