Skip to content

Commit f41f3e5

Browse files
shoheiyokoyamakzaher
authored andcommitted
Fix test
1 parent 9d4dc41 commit f41f3e5

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

Tests/RxDataSourcesTests/ChangeSet+TestExtensions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ extension Changeset {
125125
}
126126

127127
private func applySectionMovesAndInserts(original: [S]) -> [S] {
128-
if updatedSections.count > 0 {
128+
if !updatedSections.isEmpty {
129129
fatalError("Section updates aren't supported")
130130
}
131131

Tests/RxDataSourcesTests/Randomizer.swift

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ struct Randomizer {
152152

153153
// move items
154154
for _ in 0 ..< itemActionCount {
155-
if sections.count == 0 {
155+
if sections.isEmpty {
156156
continue
157157
}
158158

@@ -162,14 +162,12 @@ struct Randomizer {
162162
(nextRng, randomValue) = nextRng.get_random()
163163
let destinationSectionIndex = randomValue % sections.count
164164

165-
let sectionItemCount = sections[sourceSectionIndex].numbers.count
166-
167-
if sectionItemCount == 0 {
165+
if sections[sourceSectionIndex].numbers.isEmpty {
168166
continue
169167
}
170168

171169
(nextRng, randomValue) = nextRng.get_random()
172-
let sourceItemIndex = randomValue % sectionItemCount
170+
let sourceItemIndex = randomValue % sections[sourceSectionIndex].numbers.count
173171

174172
(nextRng, randomValue) = nextRng.get_random()
175173

@@ -185,21 +183,19 @@ struct Randomizer {
185183

186184
// delete items
187185
for _ in 0 ..< itemActionCount {
188-
if sections.count == 0 {
186+
if sections.isEmpty {
189187
continue
190188
}
191189

192190
(nextRng, randomValue) = nextRng.get_random()
193191
let sourceSectionIndex = randomValue % sections.count
194192

195-
let sectionItemCount = sections[sourceSectionIndex].numbers.count
196-
197-
if sectionItemCount == 0 {
193+
if sections[sourceSectionIndex].numbers.isEmpty {
198194
continue
199195
}
200196

201197
(nextRng, randomValue) = nextRng.get_random()
202-
let sourceItemIndex = randomValue % sectionItemCount
198+
let sourceItemIndex = randomValue % sections[sourceSectionIndex].numbers.count
203199

204200
if deleteItems {
205201
nextUnusedItems.append(sections[sourceSectionIndex].numbers.remove(at: sourceItemIndex))
@@ -211,7 +207,7 @@ struct Randomizer {
211207

212208
// move sections
213209
for _ in 0 ..< sectionActionCount {
214-
if sections.count == 0 {
210+
if sections.isEmpty {
215211
continue
216212
}
217213

@@ -231,7 +227,7 @@ struct Randomizer {
231227

232228
// delete sections
233229
for _ in 0 ..< sectionActionCount {
234-
if sections.count == 0 {
230+
if sections.isEmpty {
235231
continue
236232
}
237233

0 commit comments

Comments
 (0)