<commit_before>//
//  AKParameterAutomationTests.swift
//  iOSTestSuiteTests
//
//  Created by <NAME> on 7/16/20.
//  Copyright © 2020 AudioKit. All rights reserved.
//

import XCTest
import AudioKit

class AKParameterAutomationTests: XCTestCase {

    func testSimpleAutomation() throws {

        let address = AUParameterAddress(42)
        let automationPoints = [ AKParameterAutomationPoint(targetValue: 880, startTime: 0, rampDuration: 1.0) ]

        var addresses:[AUParameterAddress] = []

        let scheduleParameterBlock: AUScheduleParameterBlock = { (sampleTime, frameCount, address, value) in
            addresses.append(address)
        }

        let observer: AURenderObserver = automationPoints.withUnsafeBufferPointer { automationPtr in
            AKParameterAutomationGetRenderObserver(address,
                                                   scheduleParameterBlock,
                                                   44100,
                                                   0, // start time
                                                   1, // playback speed
                                                   automationPtr.baseAddress!,
                                                   automationPoints.count)
        }

        var timeStamp = AudioTimeStamp()
        timeStamp.mSampleTime = 0

        observer(.unitRenderAction_PreRender, &timeStamp, 256, 0)

        XCTAssertEqual(addresses, [9223372036854775850, 4611686018427387946, 2305843009213693994, 42])
    }

}<commit_msg>Assert that values are what we expect.<commit_after>//
//  AKParameterAutomationTests.swift
//  iOSTestSuiteTests
//
//  Created by <NAME> on 7/16/20.
//  Copyright © 2020 AudioKit. All rights reserved.
//

import XCTest
import AudioKit

class AKParameterAutomationTests: XCTestCase {

    func testSimpleAutomation() throws {

        let address = AUParameterAddress(42)
        let automationPoints = [ AKParameterAutomationPoint(targetValue: 880, startTime: 0, rampDuration: 1.0) ]

        var addresses:[AUParameterAddress] = []
        var values:[AUValue] = []

        let scheduleParameterBlock: AUScheduleParameterBlock = { (sampleTime, frameCount, address, value) in
            addresses.append(address)
            values.append(value)
        }

        let observer: AURenderObserver = automationPoints.withUnsafeBufferPointer { automationPtr in
            AKParameterAutomationGetRenderObserver(address,
                                                   scheduleParameterBlock,
                                                   44100,
                                                   0, // start time
                                                   1, // playback speed
                                                   automationPtr.baseAddress!,
                                                   automationPoints.count)
        }

        var timeStamp = AudioTimeStamp()
        timeStamp.mSampleTime = 0

        observer(.unitRenderAction_PreRender, &timeStamp, 256, 0)

        XCTAssertEqual(addresses, [9223372036854775850, 4611686018427387946, 2305843009213693994, 42])
        XCTAssertEqual(values, [1.0, 0.0, 0.0, 880.0])
    }

}
{'fraction_non_alphanumeric': 0.07270448135380758, 'fraction_numerical': 0.058288937637104354, 'mean_word_length': 1.6577851790174853, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5100142', 'n_tokens_mistral': 911, 'n_tokens_neox': 748, 'n_words': 170}