Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Power Assert in Swift.
| Date | Stars |
|---|---|
| 2026-07-24 | 492 |
| 2026-07-25 | 492 |
| 2026-07-28 | 492 |
| 2026-07-30 | 492 |
| 2026-08-06 | 492 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
<p align="center">
<img width="640px" src="https://user-images.githubusercontent.com/40610/235353186-552ae826-c981-422d-8e75-e6b487a00bbd.png" />
</p>
# Swift Power Assert

[](https://app.bitrise.io/app/4018c2f1-9f94-4913-8a4c-deb1a8e1410a)
[](https://codecov.io/gh/kishikawakatsumi/swift-power-assert)
Power asserts (also known as diagrammed assertions) augment your assertion failures with information about the values produced during evaluation of a condition, and present it in an easily digestible form. Power asserts are a popular feature of [Spock](https://github.com/spockframework/spock) (and later the entire [Groovy](https://github.com/apache/groovy) language independent of Spock), [ScalaTest](http://www.scalatest.org/) and [Expecty](https://github.com/pniederw/expecty).
Power asserts provide descriptive assertion messages for your tests, like the following examples:
```
#assert(numbers[2] == 4)
│ ││ │ │
│ │3 │ 4
│ 2 false
[1, 2, 3, 4, 5]
--- [Int] numbers[2]
+++ [Int] 4
–3
+4
[Int] numbers[2]
=> 3
[Int] 4
=> 4
#assert(numbers.contains(6))
│ │ │
│ false 6
[1, 2, 3, 4, 5]
#assert(string1 == string2)
│ │ │
│ │ "Hello, Swift!"
│ false
"Hello, world!"
--- [String] string1
+++ [String] string2
Hello, {+S+}w[-orld-]{+ift+}!
[String] string1
=> "Hello, world!"
[String] string2
=> "Hello, Swift!"
```
## Online Playground
[**Experience the library in action with our online playground!** :sparkles: Click here to access the interactive demo.](https://power-assert.swiftfiddle.com/)
## Why Power Assert?
When writing tests, we need to use different assertion functions. With Power Assert you only use the `#assert()` function. There are many
Assertion APIs, no need to remember them. Just create an expression that returns a boolean value and Power Assert will automatically display rich error information.
## Getting Started
Requirements:
- Swift 5.9 or later
- Xcode 15.0 or later
### For Xcode Project
To see PowerAssert in action, go to the Examples directory and run `xcodebuild test ...`.
```
$ cd Examples/XcodeProject/
$ xcodebuild test -scheme MyApp -destination 'platform=iOS Simulator,name=iPhone 14 Pro,OS=17.0' -parallel-testing-enabled NO
```
The parameter `-parallel-testing-enabled NO` is required. Due to recent changes in Xcode, parallel testing is now turned on by default and test messages are no longer output to the console. Therefore, to see assertion messages in the console, disable parallel testing. When parallel testing is enabled, all console logs can be viewed from the result bundle.
Or set the following UserDefaults. This option allows console output even if parallel testing is enabled.
```shell
defaults write com.apple.dt.xcodebuild ParallelTestRunnerStdoutMirroringEnabled -bool YES
```
### For Swift Package Manager
To see PowerAssert in action, go to the Examples directory and run `swift test`.
```
$ cd Examples/SwiftPackage/
$ swift test
```
See the following results?
```
...
Test Suite 'All tests' started at 2023-04-05 07:17:58.800
Test Suite 'swift-power-assert-examplePackageTests.xctest' started at 2023-04-05 07:17:58.801
Test Suite 'PowerAssertTests' started at 2023-04-05 07:17:58.801
Test Case '-[ExampleTests.PowerAssertTests testExample]' started.
/swift-power-assert/Example/"ExampleTests/ExampleTests.swift":8: error: -[ExampleTests.PowerAssertTests testExample] : failed -
#assert(a * b == 91)
│ │ │ │ │
│ │ 9 │ 91
│ 90 false
10
[Int] a
=> 10
[Int] b
=> 9Excerpt of 9,066 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:bdda52e15addb2d4, topic:testing