From a3ec238b38e584e7a78ad7cd60f2e95244054c94 Mon Sep 17 00:00:00 2001 From: jaketothepast Date: Thu, 6 Apr 2023 12:01:16 -0400 Subject: [PATCH] Implementing function to read FIT file header --- src/FIT.jl | 6 +++++- src/functions.jl | 3 +++ src/header.jl | 13 +++++++++++++ test/runtests.jl | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/functions.jl create mode 100644 src/header.jl diff --git a/src/FIT.jl b/src/FIT.jl index 1b7d687..9f241ec 100644 --- a/src/FIT.jl +++ b/src/FIT.jl @@ -1,5 +1,9 @@ module FIT -# Write your package code here. +export greet_package +export read_header +include("functions.jl") +include("header.jl") end + diff --git a/src/functions.jl b/src/functions.jl new file mode 100644 index 0000000..2f44acf --- /dev/null +++ b/src/functions.jl @@ -0,0 +1,3 @@ +function greet_package() + print("Hello package") +end diff --git a/src/header.jl b/src/header.jl new file mode 100644 index 0000000..349345d --- /dev/null +++ b/src/header.jl @@ -0,0 +1,13 @@ +struct FITHeader + sz::UInt8 +end + +""" + read_header(fit_file::IOStream) + +Read the header of the given fit file, and return a FITHeader struct +""" +function read_header(fit_file::IOStream)::FITHeader + sz = read(fit_file, 1; all=false) + FITHeader(sz[1]) +end diff --git a/test/runtests.jl b/test/runtests.jl index 17b6f30..e80dd6b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,4 +3,5 @@ using Test @testset "FIT.jl" begin # Write your tests here. + @test FIT.greet_package() == "Hello package" end