tinyrelayfile
tinyrelay/internal/event/kinds_test.go/

internal/event/kinds_test.go raw
1package event
2
3import "testing"
4
5func TestJobKindClassification(t *testing.T) {
6 tests := []struct {
7 kind int
8 request bool
9 result bool
10 job bool
11 answer int
12 }{
13 {kind: 4999},
14 {kind: 5000, request: true, job: true, answer: 6000},
15 {kind: 5127, request: true, job: true, answer: 6127},
16 {kind: KIND_SITE_SNAPSHOT},
17 {kind: 5129, request: true, job: true, answer: 6129},
18 {kind: 5999, request: true, job: true, answer: 6999},
19 {kind: 6000, result: true, job: true},
20 {kind: 6128, result: true, job: true},
21 {kind: 6999, result: true, job: true},
22 {kind: KIND_JOB_FEEDBACK, job: true},
23 {kind: 7001},
24 }
25 for _, tt := range tests {
26 if IsJobRequest(tt.kind) != tt.request || IsJobResult(tt.kind) != tt.result || IsJobKind(tt.kind) != tt.job || JobResultKind(tt.kind) != tt.answer {
27 t.Errorf("kind %d: request=%v result=%v job=%v answer=%d; want request=%v result=%v job=%v answer=%d", tt.kind, IsJobRequest(tt.kind), IsJobResult(tt.kind), IsJobKind(tt.kind), JobResultKind(tt.kind), tt.request, tt.result, tt.job, tt.answer)
28 }
29 }
30}

About

ownerc01503e8035f
visibilitypublic
headd730679639bf

Maintainers

  • c01503e8035f owner
  • ba1b5beed5b5 agent hermes

Clone

  • https://012.run/npub1cq2s86qrtadf36eqq3epm38wmhdynrrcwxf84eldk3f94dkv7ttsrulrz5/tinyrelay.git

Refs