Fortran · 4949 bytes Raw Blame History
1 program test_scaffold
2 use fgof_devloop, only : &
3 FGOF_DEVLOOP_DECISION_IDLE, &
4 FGOF_DEVLOOP_COMMAND_NONE, &
5 FGOF_DEVLOOP_TRIGGER_NONE, &
6 clear_devloop_command_result, &
7 clear_devloop_command_spec, &
8 clear_devloop_cycle, &
9 clear_devloop_decision, &
10 clear_devloop_job_plan, &
11 clear_devloop_job_spec, &
12 clear_devloop_job_state, &
13 clear_devloop_options, &
14 clear_devloop_state, &
15 clear_devloop_supervision_result, &
16 clear_devloop_trigger, &
17 clear_devloop_watch_summary, &
18 devloop_backend_name
19 use fgof_devloop_types, only : &
20 devloop_command_result, &
21 devloop_command_spec, &
22 devloop_cycle, &
23 devloop_decision, &
24 devloop_job_plan, &
25 devloop_job_spec, &
26 devloop_job_state, &
27 devloop_options, &
28 devloop_state, &
29 devloop_supervision_result, &
30 devloop_trigger, &
31 devloop_watch_summary
32 implicit none
33
34 type(devloop_state) :: state
35 type(devloop_options) :: options
36 type(devloop_trigger) :: trigger
37 type(devloop_cycle) :: cycle
38 type(devloop_decision) :: decision
39 type(devloop_command_spec) :: command_spec
40 type(devloop_command_result) :: command_result
41 type(devloop_supervision_result) :: supervision
42 type(devloop_job_spec) :: job_spec_value
43 type(devloop_job_state) :: job_state
44 type(devloop_job_plan) :: job_plan
45 type(devloop_watch_summary) :: watch_summary
46
47 state = clear_devloop_state()
48 options = clear_devloop_options()
49 trigger = clear_devloop_trigger()
50 cycle = clear_devloop_cycle()
51 decision = clear_devloop_decision()
52 command_spec = clear_devloop_command_spec()
53 command_result = clear_devloop_command_result()
54 supervision = clear_devloop_supervision_result()
55 job_spec_value = clear_devloop_job_spec()
56 job_state = clear_devloop_job_state()
57 job_plan = clear_devloop_job_plan()
58 watch_summary = clear_devloop_watch_summary()
59
60 if (state%options%max_failures /= 0) error stop "devloop options should start with unlimited failures"
61 if (.not. state%options%run_on_start) error stop "devloop should default to run on start"
62 if (.not. state%options%restart_on_change) error stop "devloop should default to restart on change"
63 if (.not. state%options%restart_on_directory_change) error stop "devloop should restart on directory changes by default"
64 if (state%options%ignore_hidden) error stop "devloop should not ignore hidden paths by default"
65 if (state%options%min_restart_changes /= 1) error stop "devloop should restart after one change by default"
66 if (state%options%debounce_polls /= 0) error stop "devloop should not debounce by default"
67 if (state%last_cycle%id /= 0) error stop "devloop state should clear the last cycle"
68 if (state%cycle_count /= 0) error stop "devloop state should start with no cycles"
69 if (state%consecutive_failures /= 0) error stop "devloop state should start with no failures"
70 if (state%active) error stop "devloop state should start inactive"
71 if (state%running) error stop "devloop state should not start running"
72 if (state%stopped) error stop "devloop state should not start stopped"
73 if (trigger%kind /= FGOF_DEVLOOP_TRIGGER_NONE) error stop "clear trigger should produce no trigger"
74 if (cycle%started) error stop "clear cycle should not start a cycle"
75 if (decision%kind /= FGOF_DEVLOOP_DECISION_IDLE) error stop "clear decision should idle"
76 if (command_spec%enabled) error stop "clear command spec should be disabled"
77 if (command_spec%kind /= FGOF_DEVLOOP_COMMAND_NONE) error stop "clear command spec should have no kind"
78 if (command_result%requested) error stop "clear command result should not be requested"
79 if (.not. command_result%skipped) error stop "clear command result should be skipped"
80 if (supervision%started) error stop "clear supervision should not be started"
81 if (supervision%command_count /= 0) error stop "clear supervision should have no commands"
82 if (job_spec_value%enabled) error stop "clear job spec should be disabled"
83 if (.not. job_spec_value%stop_before_restart) error stop "job specs should stop before restart by default"
84 if (job_state%attached) error stop "clear job state should not be attached"
85 if (job_state%running) error stop "clear job state should not be running"
86 if (job_plan%should_start) error stop "clear job plan should not start"
87 if (job_plan%should_stop) error stop "clear job plan should not stop"
88 if (options%stop_on_failure) error stop "clear options should not stop on failure by default"
89 if (options%ignore_hidden) error stop "clear options should not ignore hidden paths by default"
90 if (options%debounce_polls /= 0) error stop "clear options should not debounce by default"
91 if (watch_summary%has_changes) error stop "clear watch summary should not have changes"
92 if (watch_summary%watch_failed) error stop "clear watch summary should not fail"
93 if (devloop_backend_name() /= "model") error stop "devloop backend should report model"
94 end program test_scaffold
95