Skip to content

Commit

Permalink
Merge pull request #108 from tonybaloney/more_testing
Browse files Browse the repository at this point in the history
Add extra code generation tests for types and constants
  • Loading branch information
tonybaloney authored Aug 14, 2024
2 parents b3f8e17 + 28742a5 commit fb10964
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/CSnakes.Tests/BasicSmokeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@ public class BasicSmokeTest(TestEnvironment testEnv) : IClassFixture<TestEnviron
[InlineData("def hello_world(name: str, age: int) -> str:\n ...\n", "string HelloWorld(string name, long age)")]
[InlineData("def hello_world(numbers: list[float]) -> list[int]:\n ...\n", "IEnumerable<long> HelloWorld(IEnumerable<double> numbers)")]
[InlineData("def hello_world(numbers: List[float]) -> List[int]:\n ...\n", "IEnumerable<long> HelloWorld(IEnumerable<double> numbers)")]
[InlineData("def hello_world(value: tuple[int]) -> None:\n ...\n", "void HelloWorld(ValueTuple<long> value)")]
[InlineData("def hello_world(a: bool, b: str, c: list[tuple[int, float]]) -> bool: \n ...\n", "bool HelloWorld(bool a, string b, IEnumerable<(long, double)> c)")]
[InlineData("def hello_world(a: bool = True, b: str = None) -> bool: \n ...\n", "bool HelloWorld(bool a = true, string b = null)")]
[InlineData("def hello_world(a: bytes, b: bool = False, c: float = 0.1) -> None: \n ...\n", "void HelloWorld(byte[] a, bool b = false, double c = 0.1)")]
[InlineData("def hello_world(a: str = 'default') -> None: \n ...\n", "void HelloWorld(string a = \"default\")")]
[InlineData("def hello_world(a: str, *args) -> None: \n ...\n", "void HelloWorld(string a, ValueTuple<PyObject> args)")]
[InlineData("def hello_world(a: str, *, b: int) -> None: \n ...\n", "void HelloWorld(string a, ValueTuple<PyObject> args, long b)")]
[InlineData("def hello_world(a: str, *, b: int = 3) -> None: \n ...\n", "void HelloWorld(string a, ValueTuple<PyObject> args, long b = 3)")]
[InlineData("def hello_world(a: str, *args, **kwargs) -> None: \n ...\n", "void HelloWorld(string a, ValueTuple<PyObject> args, IReadOnlyDictionary<string, PyObject> kwargs)")]
[InlineData("def hello(a: int = 0xdeadbeef) -> None:\n ...\n", "void Hello(long a = 0xDEADBEEF)")]
[InlineData("def hello(a: int = 0b10101010) -> None:\n ...\n", "void Hello(long a = 0b10101010)")]
[InlineData("def hello(a: int = 2147483648) -> None:\n ...\n", "void Hello(long a = 2147483648L)")]
public void TestGeneratedSignature(string code, string expected)
{

Expand Down

0 comments on commit fb10964

Please sign in to comment.