Fortran · 1199 bytes Raw Blame History
1 program test_scaffold
2 use fgof_watch, only : init_watch, poll_watch, reset_watch
3 use fgof_watch_types, only : watch_event, watch_options, watch_session
4 implicit none
5
6 type(watch_event), allocatable :: events(:)
7 type(watch_options) :: options
8 type(watch_session) :: session
9
10 options = watch_options(poll_interval_ms=100, recursive=.false.)
11 call init_watch(session, "src", options)
12
13 if (.not. session%active) error stop "watch session should be active"
14 if (.not. allocated(session%root)) error stop "watch root should be allocated"
15 if (session%root /= "src") error stop "watch root should match init input"
16 if (session%options%poll_interval_ms /= 100) error stop "poll interval should be stored"
17 if (session%options%recursive) error stop "recursive flag should follow options"
18
19 events = poll_watch(session)
20 if (.not. allocated(events)) error stop "poll should always allocate an event batch"
21 if (size(events) /= 0) error stop "placeholder poll should return an empty batch"
22
23 call reset_watch(session)
24 if (session%active) error stop "reset should deactivate session"
25 if (allocated(session%root)) error stop "reset should clear root path"
26 end program test_scaffold
27