# KZAsserts
KZAsserts is a powerful assertion library for iOS and macOS development. It provides a comprehensive set of assertion macros to make writing assertions easier and more expressive.
## Features
– Easy-to-use assertion macros for common types such as strings, arrays, dictionaries, numbers, and booleans.
– Customizable failure messages to provide clear and descriptive error output.
– Support for assertion chaining and logical combinations for more complex conditions.
– Built-in assertion macros for common validations like checking for `nil`, emptiness, containment, or equality.
– Detailed failure reporting including file name and line number to aid in debugging.
## Installation
KZAsserts can be installed using several popular dependency management systems:
### CocoaPods
Add the following line to your Podfile:
“`ruby
pod ‘KZAsserts’
“`
Then, run the following command:
“`bash
$ pod install
“`
### Carthage
Add the following line to your Cartfile:
“`ruby
github “KrKleint/KZAsserts”
“`
Then, run the following command:
“`bash
$ carthage update
“`
## Usage
KZAsserts provides a wide range of macros for performing assertions. These macros are designed to be readable and provide clear feedback when an assertion fails.
### Basic Assertions
The library includes several useful macros for basic assertions:
“`swift
let value = true
assert(value, “Value should be true”)
let string = “Hello, World!”
assertEqual(string.count, 13, “String length should be equal to 13”)
“`
### Chaining Assertions
KZAsserts allows you to chain assertions together using logical operators:
“`swift
let array = [1, 2, 3, 4, 5]
assert(array.count > 0 && array.contains(2), “Array should have at least one element and contain 2”)
“`
### Custom Failure Messages
You can customize the failure message for an assertion to provide more context:
“`swift
let number = 42
assert(number > 50, “Number should be greater than 50, but found \(number)”)
“`
### Nil and Empty Checking
KZAsserts includes macros for asserting `nil` and checking emptiness:
“`swift
let optional: Int? = nil
assertNil(optional, “Optional value should be nil”)
let string = “Hello, World!”
assertEmpty(string, “String should be empty”)
“`
### Equality Assertions
You can use the equality assertion macros for checking equality between values:
“`swift
let value = “Hello”
let expected = “Hello”
assertEqual(value, expected, “Values should be equal”)
let array1 = [1, 2, 3]
let array2 = [1, 2, 3]
assertEqual(array1, array2, “Arrays should be equal”)
“`
## Documentation
For further information and detailed API documentation, please visit the [official KZAsserts GitHub repository](https://github.com/KrKleint/KZAsserts).
## License
KZAsserts is released under the [MIT license](https://github.com/KrKleint/KZAsserts/blob/master/LICENSE.txt).