Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 0 additions & 48 deletions Tests/TPPDFTests/List/PDFList+Equatable_Spec.swift

This file was deleted.

57 changes: 57 additions & 0 deletions Tests/TPPDFTests/List/PDFListEquatableTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//
// PDFListEquatableTests.swift
// TPPDF
//
// Created by Philip Niedertscheider on 05.12.2017.
// Copyright © 2016-2026 techprimate GmbH. All rights reserved.
//

import Testing
@testable import TPPDF

struct PDFListEquatableTests {
@Test func listsWithSameIndentationsAndItemsAreEqual() {
// Arrange
let list = PDFList(indentations: [(pre: 5, past: 10)])
let otherList = PDFList(indentations: [(pre: 5, past: 10)])

// Act
let isEqual = list == otherList

// Assert
#expect(isEqual)
}

@Test(arguments: [false, true])
func differentIndentationsMakeListsUnequal(addLevel: Bool) {
// Arrange
let list = PDFList(indentations: [(pre: 5, past: 10)])
let otherList = PDFList(indentations: [(pre: 10, past: 20)])
if addLevel {
otherList.levelIndentations.append((pre: 10, past: 10))
}

// Act
let isEqual = list == otherList

// Assert
#expect(!isEqual)
}

@Test(arguments: [false, true])
func differentItemCountsOrContentMakeListsUnequal(sameItemCount: Bool) {
// Arrange
let list = PDFList(indentations: [(pre: 5, past: 10)])
let otherList = PDFList(indentations: [(pre: 5, past: 10)])
otherList.addItem(PDFListItem(symbol: .dash, content: "CONTENT"))
if sameItemCount {
list.addItem(PDFListItem(symbol: .dash, content: "ANOTHERONE"))
}

// Act
let isEqual = list == otherList

// Assert
#expect(!isEqual)
}
}
42 changes: 42 additions & 0 deletions Tests/TPPDFTests/List/PDFListItemEquatableTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//
// PDFListItemEquatableTests.swift
// TPPDF
//
// Created by Philip Niedertscheider on 05.12.2017.
// Copyright © 2016-2026 techprimate GmbH. All rights reserved.
//

import Testing
@testable import TPPDF

struct PDFListItemEquatableTests {
@Test func defaultItemsAreEqual() {
// Arrange
let item = PDFListItem()
let otherItem = PDFListItem()

// Act
let isEqual = item == otherItem

// Assert
#expect(isEqual)
}

@Test(arguments: ["content", "children", "symbol"])
func changingItemValuesMakesItemsUnequal(property: String) {
// Arrange
let item = PDFListItem()
let otherItem = PDFListItem()
switch property {
case "content": otherItem.content = "RANDOM"
case "children": otherItem.children = [PDFListItem()]
default: otherItem.symbol = .custom(value: "RANDOM")
}

// Act
let isEqual = item == otherItem

// Assert
#expect(!isEqual)
}
}
Loading
Loading