mod_edges.carbon 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. // RUN: %{explorer} %s 2>&1 | \
  6. // RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
  7. // RUN: %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
  8. // RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
  9. // AUTOUPDATE: %{explorer} %s
  10. // CHECK: result: 0
  11. package ExplorerTest api;
  12. fn identFn( x: i32 ) -> i32{
  13. return x;
  14. }
  15. fn Main() -> i32 {
  16. var x : i32 = 7 % 2;
  17. if( not (x == 1) ){
  18. return 1;
  19. }
  20. x = (3*3) % 3;
  21. if( not (x == 0)){
  22. return 2;
  23. }
  24. x = (4+4+4+4) % (2+1);
  25. if( not (x == 1) ){
  26. return 3;
  27. }
  28. x = 15 % (identFn(2)+1);
  29. if( not (x == 0)){
  30. return 4;
  31. }
  32. x = -15 % 7;
  33. if( not (x == -1)){
  34. return 5;
  35. }
  36. x = 15 % -7;
  37. if( not ( x == 1)){
  38. return 6;
  39. }
  40. x = -15 % -identFn(7);
  41. if( not (x == -1)){
  42. return 7;
  43. }
  44. return 0;
  45. }