/tags/rel-1-3-25/SWIG/Examples/test-suite/csharp/long_long_runme.cs
C# | 41 lines | 30 code | 9 blank | 2 comment | 4 complexity | 86582e78cd921730b121cfcc776d8e0f MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
1 2// This is the long_long runtime testcase. It checks that the long long and 3// unsigned long long types work. 4 5using System; 6using long_longNamespace; 7 8public class long_long_runme { 9 10 public static void Main() { 11 12 check_ll(0L); 13 check_ll(0x7FFFFFFFFFFFFFFFL); 14 check_ll(-10); 15 16 check_ull(0); 17 check_ull(127); 18 check_ull(128); 19 check_ull(9223372036854775807); //0x7FFFFFFFFFFFFFFFL 20 check_ull(18446744073709551615); //0xFFFFFFFFFFFFFFFFL 21 } 22 23 public static void check_ll(long ll) { 24 long_long.ll = ll; 25 long ll_check = long_long.ll; 26 if (ll != ll_check) { 27 string ErrorMessage = "Runtime test using long long failed. ll=" + ll + " ll_check=" + ll_check; 28 throw new Exception(ErrorMessage); 29 } 30 } 31 32 public static void check_ull(ulong ull) { 33 long_long.ull = ull; 34 ulong ull_check = long_long.ull; 35 if (ull != ull_check) { 36 string ErrorMessage = "Runtime test using unsigned long long failed. ull=" + ull + " ull_check=" + ull_check; 37 throw new Exception(ErrorMessage); 38 } 39 } 40} 41