This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
late Area area; | |
setUp(() { | |
area = Area(); | |
}); | |
group("Area of the circle", () { | |
test("Area of the circle with radius 1 should be 3.141592", () { | |
// Arrange |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
late Area area; | |
setUpAll(() { | |
area = Area(); | |
}); | |
group("Area of the circle", () { | |
test("Area of the circle with radius 1 should be 3.141592", () { | |
// Arrange |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
group("Area of the circle",(){ | |
test("Area of the circle with radius 1 should be 3.141592", () { | |
// Arrange | |
Area area = Area(); | |
// Act | |
double result = area.circle(1); | |
// Assert | |
expect(result, 3.141592); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
test("Area.pi should be 3.141592", () { | |
// Arrange | |
// Act | |
// Assert | |
expect(Area.pi, 3.141592); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
test("Area of the circle with radius 1 should be 3.141592", () { | |
// Arrange | |
Area area = Area(); | |
// Act | |
double result = area.circle(1); | |
// Assert | |
expect(result, 3.141592); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Area { | |
static double get pi => 3.141592; | |
double circle(double radius) { | |
return pi * radius.square; | |
} | |
} | |
extension NumSquare on num { | |
num get square => this * this; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dev_dependencies: | |
flutter_test: | |
sdk: flutter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter_test/flutter_test.dart'; | |
void main() { | |
group("0 <= TestCases < 1K", () { | |
test("Passing 0", () { | |
expect(0.compactCount(), "0"); | |
}); | |
test("Passing 99", () { | |
expect(99.compactCount(), "99"); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
int x = 5990000; | |
print(x.compactCount()); | |
} | |
///If count is less than 1K, it returns the count as it is. | |
///This count never round to higher number eg. 9995690 -> 9.9M, It won't be 10M | |
extension CompactCount on int { | |
String compactCount() { | |
final Map<double, String> countMap = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void _drawMinutesLine(Canvas canvas) { | |
for (int minute = 1; minute <= Constants.numberOfMinutes; minute++) { | |
final double _theta = Constants.angleBetweenEachMinuteLine * minute; | |
final double _radiusOfInnerPoint = _getInnerPointRadiusOfMinuteLine(minute); | |
final Offset _extremePoint = | |
GetOffset.getOffsetWithRadiusAndTheta(radius: _minuteLineExtremePointRadius, theta: _theta); | |
final Offset _innerPoint = GetOffset.getOffsetWithRadiusAndTheta(radius: _radiusOfInnerPoint, theta: _theta); | |
canvas.drawLine(_extremePoint, _innerPoint, _paint); |