Skip to content

Commit 25843ac

Browse files
authored
Merge pull request #260 from akashgk/master
Update to latest dart version
2 parents 94b7930 + 827be3c commit 25843ac

49 files changed

Lines changed: 343 additions & 215 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/dart_test_analyze_format.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ jobs:
44
dart_test_analyze_format:
55
runs-on: ubuntu-latest
66
container:
7-
image: google/dart
7+
image: dart:stable
88
steps:
9-
- uses: actions/checkout@v2
9+
- uses: actions/checkout@v4
1010
# - run: (echo 'deb http://deb.debian.org/debian buster main contrib non-free') > /etc/apt/sources.list.d/buster.list
1111
- run: dart pub get
1212
- run: dart format --set-exit-if-changed .
1313
- run: dart test --coverage .
14-
- run: dart pub run coverage:format_coverage -i . -l > coverage.lcov
14+
- run: dart run coverage:format_coverage -i . -l > coverage.lcov
1515
- run: dart analyze

array/car_pool.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,24 @@ bool carPooling(List<List<int>> trips, int capacity) {
3333
void main() {
3434
List<List<int>> trips = [
3535
[2, 1, 5],
36-
[3, 3, 7]
36+
[3, 3, 7],
3737
];
3838

3939
List<List<int>> trips1 = [
4040
[2, 1, 5],
41-
[3, 5, 7]
41+
[3, 5, 7],
4242
];
4343

4444
List<List<int>> trips2 = [
4545
[2, 2, 6],
4646
[2, 4, 7],
47-
[8, 6, 7]
47+
[8, 6, 7],
4848
];
4949

5050
List<List<int>> trips3 = [
5151
[7, 5, 6],
5252
[6, 7, 8],
53-
[10, 1, 6]
53+
[10, 1, 6],
5454
];
5555

5656
test('test case 1', () => expect(carPooling(trips, 4), false));

array/sorted_squared_array.dart

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,26 @@ void main() {
3030
});
3131

3232
test('test case 2', () {
33-
expect(sortedSquaredArray([-7, -6, -5, -4, -3, -2, -1]),
34-
[1, 4, 9, 16, 25, 36, 49]);
33+
expect(sortedSquaredArray([-7, -6, -5, -4, -3, -2, -1]), [
34+
1,
35+
4,
36+
9,
37+
16,
38+
25,
39+
36,
40+
49,
41+
]);
3542
});
3643

3744
test('test case 4', () {
38-
expect(
39-
sortedSquaredArray([1, 2, 3, 4, 5, 6, 7]), [1, 4, 9, 16, 25, 36, 49]);
45+
expect(sortedSquaredArray([1, 2, 3, 4, 5, 6, 7]), [
46+
1,
47+
4,
48+
9,
49+
16,
50+
25,
51+
36,
52+
49,
53+
]);
4054
});
4155
}

backtracking/open_knight_tour.dart

Lines changed: 48 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -94,70 +94,77 @@ void printBoard(List<List<int>> board) {
9494
void main() {
9595
test(('getValidPos: testCase #1'), () {
9696
expect(
97-
getValidPos([1, 3], 4),
98-
equals([
99-
[2, 1],
100-
[0, 1],
101-
[3, 2]
102-
]));
97+
getValidPos([1, 3], 4),
98+
equals([
99+
[2, 1],
100+
[0, 1],
101+
[3, 2],
102+
]),
103+
);
103104
});
104105

105106
test(('getValidPos: testCase #3'), () {
106107
expect(
107-
getValidPos([1, 2], 5),
108-
equals([
109-
[2, 4],
110-
[0, 4],
111-
[2, 0],
112-
[0, 0],
113-
[3, 3],
114-
[3, 1]
115-
]));
108+
getValidPos([1, 2], 5),
109+
equals([
110+
[2, 4],
111+
[0, 4],
112+
[2, 0],
113+
[0, 0],
114+
[3, 3],
115+
[3, 1],
116+
]),
117+
);
116118
});
117119

118120
test(('isComplete: testCase #1'), () {
119121
expect(
120-
isComplete([
121-
[1]
122-
]),
123-
equals(true));
122+
isComplete([
123+
[1],
124+
]),
125+
equals(true),
126+
);
124127
});
125128

126129
test(('isComplete: testCase #2'), () {
127130
expect(
128-
isComplete([
129-
[1, 2],
130-
[3, 0]
131-
]),
132-
equals(false));
131+
isComplete([
132+
[1, 2],
133+
[3, 0],
134+
]),
135+
equals(false),
136+
);
133137
});
134138

135139
test(('openKnightTour: testCase #1'), () {
136140
expect(
137-
openKnightTour(1),
138-
equals([
139-
[1]
140-
]));
141+
openKnightTour(1),
142+
equals([
143+
[1],
144+
]),
145+
);
141146
});
142147

143148
test(('openKnightTour: testCase #2'), () {
144149
expect(
145-
openKnightTour(2),
146-
equals([
147-
[0, 0],
148-
[0, 0]
149-
]));
150+
openKnightTour(2),
151+
equals([
152+
[0, 0],
153+
[0, 0],
154+
]),
155+
);
150156
});
151157

152158
test(('openKnightTour: testCase #3'), () {
153159
expect(
154-
openKnightTour(5),
155-
equals([
156-
[1, 14, 19, 8, 25],
157-
[6, 9, 2, 13, 18],
158-
[15, 20, 7, 24, 3],
159-
[10, 5, 22, 17, 12],
160-
[21, 16, 11, 4, 23]
161-
]));
160+
openKnightTour(5),
161+
equals([
162+
[1, 14, 19, 8, 25],
163+
[6, 9, 2, 13, 18],
164+
[15, 20, 7, 24, 3],
165+
[10, 5, 22, 17, 12],
166+
[21, 16, 11, 4, 23],
167+
]),
168+
);
162169
});
163170
}

conversions/Decimal_To_Any.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ String decimalToAny(int value, int base) {
3131
32: 'W',
3232
33: 'X',
3333
34: 'Y',
34-
35: 'Z'
34+
35: 'Z',
3535
};
3636

3737
if (value == 0) return "0";
@@ -48,7 +48,8 @@ String decimalToAny(int value, int base) {
4848
while (value > 0) {
4949
int remainder = value % base;
5050
value = value ~/ base;
51-
output = (remainder < 10
51+
output =
52+
(remainder < 10
5253
? remainder.toString()
5354
: ALPHABET_VALUES[remainder] ?? '0') +
5455
output;

conversions/Integer_To_Roman.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ List<int> ArabianRomanNumbers = [
2020
9,
2121
5,
2222
4,
23-
1
23+
1,
2424
];
2525

2626
List<String> RomanNumbers = [
@@ -36,7 +36,7 @@ List<String> RomanNumbers = [
3636
"IX",
3737
"V",
3838
"IV",
39-
"I"
39+
"I",
4040
];
4141

4242
List<String> integer_to_roman(int num) {

conversions/binary_to_decimal.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ int binaryToDecimal(String binaryString) {
1414
if ("01".contains(binaryString[i]) == false) {
1515
throw FormatException("Non-binary value was passed to the function");
1616
} else {
17-
decimalValue += (pow(2, binaryString.length - i - 1).toInt() *
17+
decimalValue +=
18+
(pow(2, binaryString.length - i - 1).toInt() *
1819
(int.tryParse(binaryString[i]) ?? 0));
1920
}
2021
}

conversions/hexadecimal_to_decimal.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ int hexadecimal_to_decimal(String hex_string) {
3232
hex_table.containsKey(hex_string[i]) == false) {
3333
throw Exception("Non-hex value was passed to the function");
3434
} else {
35-
decimal_val += pow(16, hex_string.length - i - 1).toInt() *
35+
decimal_val +=
36+
pow(16, hex_string.length - i - 1).toInt() *
3637
(int.tryParse(hex_string[i]) ?? hex_table[hex_string[i]] ?? 0);
3738
}
3839
}

conversions/hexadecimal_to_octal.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ String hexadecimal_to_octal(String hex_val) {
6464
break;
6565
default:
6666
throw new FormatException(
67-
"An invalid value was passed to the function");
67+
"An invalid value was passed to the function",
68+
);
6869
}
6970
}
7071

conversions/roman_to_integer.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ int value(var r) {
3232
return 100;
3333
else if (r == 'D')
3434
return 500;
35-
else if (r == 'M') return 1000;
35+
else if (r == 'M')
36+
return 1000;
3637
return 0;
3738
}
3839

0 commit comments

Comments
 (0)