Skip to content

Commit

Permalink
Add some interval unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
imaNNeo committed Apr 30, 2024
1 parent d658fdd commit f8d13d9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion example/macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
33CC10EC2044A3C60003C045 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion lib/src/utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ class Utils {

/// Finds the best initial interval value
///
/// If there is a zero point in the axis, we a value that passes through it.
/// If there is a zero point in the axis, we want to have a value that passes through it.
/// For example if we have -3 to +3, with interval 2. if we start from -3, we get something like this: -3, -1, +1, +3
/// But the most important point is zero in most cases. with this logic we get this: -2, 0, 2
double getBestInitialIntervalValue(
Expand Down
22 changes: 20 additions & 2 deletions test/chart/base/axis_chart/axis_chart_helper_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void main() {
expect(results[4], 10);
});

test('test 4', () {
test('test 5', () {
final results = <double>[];
final axisValues = AxisChartHelper().iterateThroughAxis(
min: 0,
Expand All @@ -95,7 +95,7 @@ void main() {
expect(results[2], 9);
});

test('test 4', () {
test('test 6', () {
final results = <double>[];
final axisValues = AxisChartHelper().iterateThroughAxis(
min: 35,
Expand All @@ -112,6 +112,24 @@ void main() {
expect(results[2], 100);
expect(results[3], 130);
});

test('test 7', () {
final results = <double>[];
final axisValues = AxisChartHelper().iterateThroughAxis(
min: 5,
max: 35,
interval: 10,
baseLine: 5,
);
for (final axisValue in axisValues) {
results.add(axisValue);
}
expect(results.length, 4);
expect(results[0], 5);
expect(results[1], 15);
expect(results[2], 25);
expect(results[3], 35);
});
});

group('calcFitInsideOffset', () {
Expand Down

0 comments on commit f8d13d9

Please sign in to comment.