Skip to content

Commit

Permalink
Added dataset unit test to lists in swift
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuri6037 committed Aug 19, 2024
1 parent 19dce7f commit 1460cc0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Binary file not shown.
17 changes: 17 additions & 0 deletions Swift/testprogTests/ListsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,21 @@ final class ListsTests: XCTestCase {
try assertSpanRun(msg.data);
}

func testDataset() throws {
var buffer = DataBuffer();
var list = ListsDatasetRuns(DataBuffer());
try writeSpanRun({ msg in try list.writeItem(msg) });
try writeSpanRun({ msg in try list.writeItem(msg) });
try writeSpanRun({ msg in try list.writeItem(msg) });
try ListsDataset.write(input: ListsDataset(runs: list), to: &buffer);
let msg = try ListsDataset.from(slice: buffer);
XCTAssertEqual(msg.size, buffer.size);
let data = msg.data;
XCTAssertEqual(data.runs.count, 3);
let items = try data.runs.toArray();
try assertSpanRun(items[0]);
try assertSpanRun(items[1]);
try assertSpanRun(items[2]);
}

}

0 comments on commit 1460cc0

Please sign in to comment.