Fortran · 1277 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 : FGOF_WATCH_EVT_NONE, watch_event, watch_options, watch_session
4 implicit none
5
6 type(watch_event) :: event
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 event = poll_watch(session)
20 if (event%kind /= FGOF_WATCH_EVT_NONE) error stop "scaffold poll should report none"
21 if (.not. allocated(event%path)) error stop "scaffold poll should return a path"
22 if (event%path /= "src") error stop "scaffold poll should echo root path"
23
24 call reset_watch(session)
25 if (session%active) error stop "reset should deactivate session"
26 if (allocated(session%root)) error stop "reset should clear root path"
27 end program test_scaffold
28