Skip to content

Commit

Permalink
Update ImageCodecTest.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
SusanDoggie committed Apr 15, 2023
1 parent fb09eca commit 421a7ab
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions Tests/DoggieTests/ImageCodecTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,13 @@ class ImageCodecTest: XCTestCase {

for (i, pixel) in zip(answer, pixels) {

let red = round(Double(((i >> 10) & 0x1F) * 0xFF) / 31) / 255
let green = round(Double(((i >> 5) & 0x1F) * 0xFF) / 31) / 255
let blue = round(Double((i & 0x1F) * 0xFF) / 31) / 255
let r = ((i >> 10) & 0x1F) * 0xFF
let g = ((i >> 5) & 0x1F) * 0xFF
let b = (i & 0x1F) * 0xFF

let red = round(Double(r) / 31) / 255
let green = round(Double(g) / 31) / 255
let blue = round(Double(b) / 31) / 255

XCTAssertEqual(red, pixel.red)
XCTAssertEqual(green, pixel.green)
Expand Down Expand Up @@ -229,9 +233,13 @@ class ImageCodecTest: XCTestCase {

for (i, pixel) in zip(answer, pixels) {

let red = round(Double(((i >> 10) & 0x1F) * 0xFF) / 31) / 255
let green = round(Double(((i >> 5) & 0x1F) * 0xFF) / 31) / 255
let blue = round(Double((i & 0x1F) * 0xFF) / 31) / 255
let r = ((i >> 10) & 0x1F) * 0xFF
let g = ((i >> 5) & 0x1F) * 0xFF
let b = (i & 0x1F) * 0xFF

let red = round(Double(r) / 31) / 255
let green = round(Double(g) / 31) / 255
let blue = round(Double(b) / 31) / 255

XCTAssertEqual(red, pixel.red)
XCTAssertEqual(green, pixel.green)
Expand Down Expand Up @@ -269,9 +277,13 @@ class ImageCodecTest: XCTestCase {

for (i, pixel) in zip(answer, pixels) {

let red = round(Double(((i >> 24) & 0xFF) * 0xFFFF) / 255) / 65535
let green = round(Double(((i >> 16) & 0xFF) * 0xFFFF) / 255) / 65535
let blue = Double(i & 0xFFFF) / 65535
let r = ((i >> 24) & 0xFF) * 0xFFFF
let g = ((i >> 16) & 0xFF) * 0xFFFF
let b = i & 0xFFFF

let red = round(Double(r) / 255) / 65535
let green = round(Double(g) / 255) / 65535
let blue = Double(b) / 65535

XCTAssertEqual(red, pixel.red)
XCTAssertEqual(green, pixel.green)
Expand Down

0 comments on commit 421a7ab

Please sign in to comment.