// // HighlightTests.swift // // // Created by Shadowfacts on 12/10/22. // import XCTest @testable import highlight_swift class HighlightTests: XCTestCase { static var allTests = [ ("testHighlight", testHighlight), ] func testHighlight() { var code = "1+1" var len: UInt64 = 0 let result = code.withUTF8 { codePtr in withUnsafeMutablePointer(to: &len) { lenPtr in highlight(codePtr: codePtr.baseAddress!, codeLen: UInt64(codePtr.count), htmlLenPtr: lenPtr) } } let htmlPtr = UnsafeBufferPointer(start: result, count: Int(len)) let data = Data(buffer: htmlPtr) let expected = "1+1" XCTAssertEqual(String(data: data, encoding: .utf8), expected) } }