variables.rs 726 B

12345678910111213141516171819202122232425262728293031323334
  1. // SPDX-License-Identifier: Apache-2.0
  2. use crate::build_solidity;
  3. #[test]
  4. fn global_constants() {
  5. let mut runtime = build_solidity(
  6. r##"
  7. int32 constant foo = 102 + 104;
  8. contract a {
  9. function test() public payable {
  10. assert(foo == 206);
  11. }
  12. }"##,
  13. );
  14. runtime.constructor(0, Vec::new());
  15. runtime.function("test", Vec::new());
  16. let mut runtime = build_solidity(
  17. r##"
  18. string constant foo = "FOO";
  19. contract a {
  20. function test() public payable {
  21. assert(foo == "FOO");
  22. }
  23. }"##,
  24. );
  25. runtime.constructor(0, Vec::new());
  26. runtime.function("test", Vec::new());
  27. }