PageRenderTime 46ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/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. // This is the long_long runtime testcase. It checks that the long long and
  2. // unsigned long long types work.
  3. using System;
  4. using long_longNamespace;
  5. public class long_long_runme {
  6. public static void Main() {
  7. check_ll(0L);
  8. check_ll(0x7FFFFFFFFFFFFFFFL);
  9. check_ll(-10);
  10. check_ull(0);
  11. check_ull(127);
  12. check_ull(128);
  13. check_ull(9223372036854775807); //0x7FFFFFFFFFFFFFFFL
  14. check_ull(18446744073709551615); //0xFFFFFFFFFFFFFFFFL
  15. }
  16. public static void check_ll(long ll) {
  17. long_long.ll = ll;
  18. long ll_check = long_long.ll;
  19. if (ll != ll_check) {
  20. string ErrorMessage = "Runtime test using long long failed. ll=" + ll + " ll_check=" + ll_check;
  21. throw new Exception(ErrorMessage);
  22. }
  23. }
  24. public static void check_ull(ulong ull) {
  25. long_long.ull = ull;
  26. ulong ull_check = long_long.ull;
  27. if (ull != ull_check) {
  28. string ErrorMessage = "Runtime test using unsigned long long failed. ull=" + ull + " ull_check=" + ull_check;
  29. throw new Exception(ErrorMessage);
  30. }
  31. }
  32. }