function [success] = toaConversion()
%TOACONVERSION Tests if the TOA conversion is correct.
% Uses the variable TOA of float_0272.mat file to check if the calculations
% are correct.

[currentDirectory, ~, ~] = fileparts(mfilename('fullpath'));
dataFileName = fullfile(currentDirectory, '..', 'data', '0272.rfb');
float = artoa.load.rfb(dataFileName);

% load test mat file exported from old version of artoa3
load(fullfile(currentDirectory, '..', 'data', 'float_0272_globals.mat'));

global TOA;

convertedToPhaseRefTime = artoa.convert.rawToa2PhaseRefTime(float);

convertedToa = artoa.data.addFloatOffsetAndSignalLength(float, convertedToPhaseRefTime);

success = ~any((TOA - convertedToa) > 0);

end

