MCPcopy Create free account
hub / github.com/facebook/time / TestMathPrepare

Function TestMathPrepare

fbclock/daemon/daemon_test.go:189–270  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

187}
188
189func TestMathPrepare(t *testing.T) {
190 testCases := []struct {
191 name string
192 in *Math
193 wantErr bool
194 }{
195 {
196 name: "basic math",
197 in: &Math{
198 M: "1 + 3",
199 W: "4 / 1",
200 Drift: "1 - 0",
201 },
202 wantErr: false,
203 },
204 {
205 name: "unknown function",
206 in: &Math{
207 M: "1 + 3",
208 W: "missing(m)",
209 Drift: "1 - 0",
210 },
211 wantErr: true,
212 },
213 {
214 name: "known function",
215 in: &Math{
216 M: "1 + 3",
217 W: "mean(m)",
218 Drift: "1 - 0",
219 },
220 wantErr: false,
221 },
222 {
223 name: "unknown variable",
224 in: &Math{
225 M: "1 + 3",
226 W: "mean(missing)",
227 Drift: "1 - 0",
228 },
229 wantErr: true,
230 },
231 {
232 name: "no data",
233 in: &Math{
234 M: "",
235 W: "",
236 Drift: "",
237 },
238 wantErr: true,
239 },
240 {
241 name: "all good",
242 in: &Math{
243 M: "abs(mean(offset, 30)) + 1.0 * stddev(offset, 30) + 1.0 * stddev(delay, 10) + 1.0 * stddev(freq, 5)",
244 W: "mean(m, 30) + 4.0 * stddev(m, 30)",
245 Drift: "mean(freqchangeabs, 29)",
246 },

Callers

nothing calls this directly

Calls 3

PrepareMethod · 0.80
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…