diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-11-08 12:22:35 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-11-08 12:22:35 -0800 |
commit | 118a6bd6c5aca371ecfcf9f7baf748a7dfd43351 (patch) | |
tree | 0f36050b3b3702a852e7cbda547539c9d446aae8 /tests/runner.py | |
parent | 2ac32ae20a38029c1fffd9e162c92f9370283dd7 (diff) |
support inet_ntoa and inet_aton, and fix inet_ntop bug with not writing null terminator
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-x | tests/runner.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py index bd056ab4..a572b4ee 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -5219,6 +5219,23 @@ def process(filename): ''' self.do_run(src, '*d4c3b2a1,e07235fe,f0cdab07,cdab,34122143,afbe*\n4e0ab4be\n') + def test_inet2(self): + src = r''' + #include <stdio.h> + #include <arpa/inet.h> + + int main() { + struct in_addr x, x2; + int *y = (int*)&x; + *y = 0x12345678; + printf("%s\n", inet_ntoa(x)); + int r = inet_aton(inet_ntoa(x), &x2); + printf("%s\n", inet_ntoa(x2)); + return 0; + } + ''' + self.do_run(src, '120.86.52.18\n120.86.52.18\n') + def test_gethostbyname(self): if Settings.USE_TYPED_ARRAYS != 2: return self.skip("assume t2 in gethostbyname") |