mod_edges.carbon 802 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. // RUN: %{explorer-run}
  7. // RUN: %{explorer-run-trace}
  8. // CHECK:STDOUT: result: 0
  9. package ExplorerTest api;
  10. fn identFn( x: i32 ) -> i32{
  11. return x;
  12. }
  13. fn Main() -> i32 {
  14. var x : i32 = 7 % 2;
  15. if( x != 1){
  16. return 1;
  17. }
  18. x = (3*3) % 3;
  19. if( x != 0){
  20. return 2;
  21. }
  22. x = (4+4+4+4) % (2+1);
  23. if( x != 1){
  24. return 3;
  25. }
  26. x = 15 % (identFn(2)+1);
  27. if( x != 0){
  28. return 4;
  29. }
  30. x = -15 % 7;
  31. if( x != -1){
  32. return 5;
  33. }
  34. x = 15 % -7;
  35. if( x != 1){
  36. return 6;
  37. }
  38. x = -15 % -identFn(7);
  39. if( x != -1){
  40. return 7;
  41. }
  42. return 0;
  43. }