Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
bassosimone committed Feb 7, 2024
1 parent 3e0e819 commit a3279f6
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 0 deletions.
15 changes: 15 additions & 0 deletions internal/experiment/fbmessenger/fbmessenger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,9 @@ func TestSummaryKeysWithNils(t *testing.T) {
if sk.IsAnomaly {
t.Fatal("invalid isAnomaly")
}
if sk.Anomaly() != sk.IsAnomaly {
t.Fatal("the values should match")
}
}

func TestSummaryKeysWithFalseFalse(t *testing.T) {
Expand All @@ -419,6 +422,9 @@ func TestSummaryKeysWithFalseFalse(t *testing.T) {
if sk.IsAnomaly {
t.Fatal("invalid isAnomaly")
}
if sk.Anomaly() != sk.IsAnomaly {
t.Fatal("the values should match")
}
}

func TestSummaryKeysWithFalseTrue(t *testing.T) {
Expand All @@ -439,6 +445,9 @@ func TestSummaryKeysWithFalseTrue(t *testing.T) {
if sk.IsAnomaly == false {
t.Fatal("invalid isAnomaly")
}
if sk.Anomaly() != sk.IsAnomaly {
t.Fatal("the values should match")
}
}

func TestSummaryKeysWithTrueFalse(t *testing.T) {
Expand All @@ -459,6 +468,9 @@ func TestSummaryKeysWithTrueFalse(t *testing.T) {
if sk.IsAnomaly == false {
t.Fatal("invalid isAnomaly")
}
if sk.Anomaly() != sk.IsAnomaly {
t.Fatal("the values should match")
}
}

func TestSummaryKeysWithTrueTrue(t *testing.T) {
Expand All @@ -479,4 +491,7 @@ func TestSummaryKeysWithTrueTrue(t *testing.T) {
if sk.IsAnomaly == false {
t.Fatal("invalid isAnomaly")
}
if sk.Anomaly() != sk.IsAnomaly {
t.Fatal("the values should match")
}
}
3 changes: 3 additions & 0 deletions internal/experiment/hhfm/hhfm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,9 @@ func TestSummaryKeysWorksAsIntended(t *testing.T) {
if sk.IsAnomaly != tt.isAnomaly {
t.Fatal("unexpected isAnomaly value")
}
if sk.IsAnomaly != sk.Anomaly() {
t.Fatal("unexpected Anomaly() value")
}
})
}
}
6 changes: 6 additions & 0 deletions internal/experiment/hirl/hirl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,9 @@ func TestSummaryKeysFalse(t *testing.T) {
if sk.IsAnomaly {
t.Fatal("invalid isAnomaly")
}
if sk.Anomaly() != sk.IsAnomaly {
t.Fatal("invalid Anomaly()")
}
}

func TestSummaryKeysTrue(t *testing.T) {
Expand All @@ -615,4 +618,7 @@ func TestSummaryKeysTrue(t *testing.T) {
if sk.IsAnomaly == false {
t.Fatal("invalid isAnomaly")
}
if sk.Anomaly() != sk.IsAnomaly {
t.Fatal("invalid Anomaly()")
}
}
3 changes: 3 additions & 0 deletions internal/experiment/ndt7/ndt7_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,7 @@ func TestSummaryKeysGood(t *testing.T) {
if sk.IsAnomaly {
t.Fatal("invalid isAnomaly")
}
if sk.IsAnomaly != sk.Anomaly() {
t.Fatal("invalid Anomaly()")
}
}
3 changes: 3 additions & 0 deletions internal/experiment/psiphon/psiphon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,7 @@ func TestSummaryKeysFailure(t *testing.T) {
if sk.IsAnomaly == false {
t.Fatal("invalid isAnomaly")
}
if sk.IsAnomaly != sk.Anomaly() {
t.Fatal("invalid Anomaly()")
}
}
20 changes: 20 additions & 0 deletions internal/experiment/signal/signal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,23 @@ func TestBadSignalCA(t *testing.T) {
t.Fatal("not the error we expected")
}
}

func TestSummaryKeys(t *testing.T) {
t.Run("without anomaly", func(t *testing.T) {
sk := &signal.SummaryKeys{
IsAnomaly: false,
}
if sk.IsAnomaly != sk.Anomaly() {
t.Fatal("invalid Anomaly()")
}
})

t.Run("with anomaly", func(t *testing.T) {
sk := &signal.SummaryKeys{
IsAnomaly: false,
}
if sk.IsAnomaly != sk.Anomaly() {
t.Fatal("invalid Anomaly()")
}
})
}
3 changes: 3 additions & 0 deletions internal/experiment/telegram/telegram_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ func TestSummaryKeysWorksAsIntended(t *testing.T) {
if sk.IsAnomaly != tt.isAnomaly {
t.Fatal("unexpected isAnomaly value")
}
if sk.IsAnomaly != sk.Anomaly() {
t.Fatal("invalid Anomaly()")
}
})
}
}
Expand Down
3 changes: 3 additions & 0 deletions internal/experiment/tor/tor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,9 @@ func TestSummaryKeysWorksAsIntended(t *testing.T) {
if sk.IsAnomaly != tt.isAnomaly {
t.Fatal("unexpected isAnomaly value")
}
if sk.IsAnomaly != sk.Anomaly() {
t.Fatal("invalid Anomaly()")
}
})
}
}
Expand Down
6 changes: 6 additions & 0 deletions internal/experiment/torsf/torsf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,9 @@ func TestMeasurementSummaryKeys(t *testing.T) {
if rsk.IsAnomaly {
t.Fatal("expected no anomaly here")
}
if rsk.IsAnomaly != sk.Anomaly() {
t.Fatal("invalid Anomaly()")
}
})

t.Run("in case of failure", func(t *testing.T) {
Expand All @@ -437,5 +440,8 @@ func TestMeasurementSummaryKeys(t *testing.T) {
if !rsk.IsAnomaly {
t.Fatal("expected anomaly here")
}
if rsk.IsAnomaly != sk.Anomaly() {
t.Fatal("invalid Anomaly()")
}
})
}
6 changes: 6 additions & 0 deletions internal/experiment/vanillator/vanillator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,9 @@ func TestMeasurementSummaryKeys(t *testing.T) {
if rsk.IsAnomaly {
t.Fatal("expected no anomaly here")
}
if rsk.IsAnomaly != sk.Anomaly() {
t.Fatal("invalid Anomaly()")
}
})

t.Run("in case of failure", func(t *testing.T) {
Expand All @@ -320,5 +323,8 @@ func TestMeasurementSummaryKeys(t *testing.T) {
if !rsk.IsAnomaly {
t.Fatal("expected anomaly here")
}
if rsk.IsAnomaly != sk.Anomaly() {
t.Fatal("invalid Anomaly()")
}
})
}
3 changes: 3 additions & 0 deletions internal/experiment/webconnectivity/webconnectivity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,9 @@ func TestSummaryKeysWorksAsIntended(t *testing.T) {
if sk.Blocking != tt.Blocking {
t.Fatal("unexpected Accessible value")
}
if sk.IsAnomaly != sk.Anomaly() {
t.Fatal("invalid Anomaly()")
}
})
}
}
3 changes: 3 additions & 0 deletions internal/experiment/whatsapp/whatsapp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,9 @@ func TestSummaryKeysWorksAsIntended(t *testing.T) {
if sk.EndpointsBlocking != tt.EndpointsBlocking {
t.Fatal("unexpected endpointsBlocking value")
}
if sk.IsAnomaly != sk.Anomaly() {
t.Fatal("invalid Anomaly()")
}
})
}
}

0 comments on commit a3279f6

Please sign in to comment.