| library /*isNonNullableByDefault*/; |
| import self as self; |
| import "dart:core" as core; |
| import "package:expect/expect.dart" as exp; |
| |
| import "package:expect/expect.dart"; |
| |
| static field core::int global = 0; |
| static method fact4() → dynamic { |
| core::int f = 1; |
| for (core::int n in <core::int>[1, 2, 3, 4]) { |
| f = f.{core::num::*}(n){(core::num) → core::int}; |
| } |
| return f; |
| } |
| static method fact5() → dynamic { |
| core::int f = 1; |
| core::int n; |
| for (final core::int #t1 in <core::int>[1, 2, 3, 4, 5]) { |
| n = #t1; |
| f = f.{core::num::*}(n){(core::num) → core::int}; |
| } |
| return f; |
| } |
| static method fact6() → dynamic { |
| core::int f = 1; |
| for (final core::int #t2 in <core::int>[1, 2, 3, 4, 5, 6]) { |
| self::global = #t2; |
| f = f.{core::num::*}(self::global){(core::num) → core::int}; |
| } |
| return f; |
| } |
| static method main() → dynamic { |
| exp::Expect::isTrue(self::fact4() =={core::Object::==}{(core::Object) → core::bool} 24); |
| exp::Expect::isTrue(self::fact5() =={core::Object::==}{(core::Object) → core::bool} 120); |
| exp::Expect::isTrue(self::fact6() =={core::Object::==}{(core::Object) → core::bool} 720); |
| } |