initial commit

This commit is contained in:
Peter Tillemans 2023-10-08 12:14:38 +02:00
commit 85d353287c
9 changed files with 89 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
_build

4
bin/dune Normal file
View file

@ -0,0 +1,4 @@
(executable
(public_name oblub)
(name main)
(libraries base oblub))

1
bin/main.ml Normal file
View file

@ -0,0 +1 @@
let () = print_endline "Hello, World!"

26
dune-project Normal file
View file

@ -0,0 +1,26 @@
(lang dune 3.11)
(name oblub)
(generate_opam_files true)
(source
(github username/reponame))
(authors "Author Name")
(maintainers "Maintainer Name")
(license LICENSE)
(documentation https://url/to/documentation)
(package
(name oblub)
(synopsis "A short synopsis")
(description "A longer description")
(depends ocaml dune)
(tags
(topics "to describe" your project)))
; See the complete stanza docs at https://dune.readthedocs.io/en/stable/dune-files.html#dune-project

19
lib/Ds1820.ml Normal file
View file

@ -0,0 +1,19 @@
open! Base
let parse s =
Stdlib.Scanf.sscanf s "%s@ t=%f" (fun _ t -> t /. 1000.)
let%test_unit "parse temperature" =
[%test_eq: float ] (parse "brol\nmore junk text t=18241") 18.241
let read_temperature file_name =
let open Lwt.Infix in
let rec aux () =
Lwt_io.with_file ~mode:Lwt_io.Input file_name (fun ic ->
Lwt_io.read_all ic >>= function
| None -> aux ()
| Some s -> Lwt.return (parse s)
)
in
aux

5
lib/dune Normal file
View file

@ -0,0 +1,5 @@
(library
(name oblub)
(inline_tests)
(libraries lwt lwt.unix)
(preprocess (pps ppx_inline_test ppx_assert ppx_expect)))

31
oblub.opam Normal file
View file

@ -0,0 +1,31 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "A short synopsis"
description: "A longer description"
maintainer: ["Maintainer Name"]
authors: ["Author Name"]
license: "LICENSE"
tags: ["topics" "to describe" "your" "project"]
homepage: "https://github.com/username/reponame"
doc: "https://url/to/documentation"
bug-reports: "https://github.com/username/reponame/issues"
depends: [
"ocaml"
"dune" {>= "3.11"}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/username/reponame.git"

2
test/dune Normal file
View file

@ -0,0 +1,2 @@
(test
(name oblub))

0
test/oblub.ml Normal file
View file