Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TranslatorSpec tests #273

Merged
merged 16 commits into from
Mar 8, 2024
Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
5932bd9
TranslatorSpec: C++: Fix test for boolean to string conversion (bool.…
Mingun Mar 8, 2024
4012ce1
TranslatorSpec: C++: Fix to_i conversion that was changed in 0acd030c…
Mingun Mar 8, 2024
0bb6be5
TranslatorSpec: C#: Fix string reverse tests that was changed in f8a9…
Mingun Mar 8, 2024
9100de3
TranslatorSpec: C#, JavaScript, Lua: Fix tests of length calculation …
Mingun Mar 8, 2024
cdf4bcb
TranslatorSpec: Go: Correct expected value of translation of fields i…
Mingun Mar 8, 2024
46ab0b2
TranslatorSpec: Go: Fix test for \u000a character translation
Mingun Mar 8, 2024
3a0a7a1
TranslatorSpec: Go: Fix tests for to_i conversion for strings
Mingun Mar 8, 2024
f553ec2
TranslatorSpec: Go: Fix a `.last` expression tests
Mingun Mar 8, 2024
6f658a0
TranslatorSpec: Go: Fix tests of casting to byte arrays
Mingun Mar 8, 2024
d1d1d66
TranslatorSpec: Java: Correct test of `_root` translation
Mingun Mar 8, 2024
a598081
TranslatorSpec: Java: Array subscript tests should use cast to int, a…
Mingun Mar 8, 2024
2ee122e
TranslatorSpec: JavaScript: Change usage of octal literals to hex lit…
Mingun Mar 8, 2024
e2b6967
TranslatorSpec: Lua: Constant folding not implemented now, fix tests …
Mingun Mar 8, 2024
b15324d
TranslatorSpec: Python: fix translation of array literals where all e…
Mingun Mar 8, 2024
30c0201
TranslatorSpec: Expressions gets translated in parenthesis so correct…
Mingun Mar 8, 2024
714e95c
Merge branch 'master' into fix-translator-tests
GreyCat Mar 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
TranslatorSpec: C++: Fix to_i conversion that was changed in 0acd030
Fixes

[info] - cpp_stl:"12345".to_i *** FAILED ***
[info]   "[kaitai::kstream::string_to_int](std::string("12345"..." was not equal to "[std::stoi](std::string("12345"..." (TranslatorSpec.scala:520)
[info]   Analysis:
[info]   "[kaitai::kstream::string_to_int](std::string("12345"..." -> "[std::stoi](std::string("12345"..."
[info] - cpp_stl:"1234fe".to_i(16) *** FAILED ***
[info]   "[kaitai::kstream::string_to_int(std::string("1234fe")], 16)" was not equal to "[std::stoi(std::string("1234fe"), 0], 16)" (TranslatorSpec.scala:533)
[info]   Analysis:
[info]   "[kaitai::kstream::string_to_int(std::string("1234fe")], 16)" -> "[std::stoi(std::string("1234fe"), 0], 16)"
Mingun committed Mar 8, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 4012ce16a5be3e6641874b87fe4340be9f68e882
Original file line number Diff line number Diff line change
@@ -537,7 +537,7 @@ class TranslatorSpec extends AnyFunSpec {
))

full("\"12345\".to_i", CalcIntType, CalcIntType, Map[LanguageCompilerStatic, String](
CppCompiler -> "std::stoi(std::string(\"12345\"))",
CppCompiler -> "kaitai::kstream::string_to_int(std::string(\"12345\"))",
CSharpCompiler -> "Convert.ToInt64(\"12345\", 10)",
GoCompiler -> "func()(int){i, err := strconv.Atoi(\"12345\"); if (err != nil) { panic(err) }; return i}()",
JavaCompiler -> "Long.parseLong(\"12345\", 10)",
@@ -550,7 +550,7 @@ class TranslatorSpec extends AnyFunSpec {
))

full("\"1234fe\".to_i(16)", CalcIntType, CalcIntType, Map[LanguageCompilerStatic, String](
CppCompiler -> "std::stoi(std::string(\"1234fe\"), 0, 16)",
CppCompiler -> "kaitai::kstream::string_to_int(std::string(\"1234fe\"), 16)",
CSharpCompiler -> "Convert.ToInt64(\"1234fe\", 16)",
GoCompiler -> "func()(int64){i, err := strconv.ParseInt(\"1234fe\", 16, 64); if (err != nil) { panic(err) }; return i}()",
JavaCompiler -> "Long.parseLong(\"1234fe\", 16)",