[tor-commits] [check/master] Test LikelyTBB

arlo at torproject.org arlo at torproject.org
Fri Jun 26 04:44:36 UTC 2015


commit 682823141993e77cb5151ad655ec612550a678a5
Author: Arlo Breault <arlolra at gmail.com>
Date:   Thu Jun 25 21:39:48 2015 -0700

    Test LikelyTBB
---
 utils_test.go |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/utils_test.go b/utils_test.go
new file mode 100644
index 0000000..b16a475
--- /dev/null
+++ b/utils_test.go
@@ -0,0 +1,21 @@
+package main
+
+import "testing"
+
+var UserAgents = map[string]bool{
+	"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:10.0.2) Gecko/20100101 Firefox/10.0.2":                                    false,
+	"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:11.0) Gecko/20100101 Firefox/11.0":                                        false,
+	"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36": false,
+	"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/536.30.1 (KHTML, like Gecko) Version/6.0.5 Safari/536.30.1":    false,
+	"Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0":                                                        true,
+	"Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0":                                                        true,
+	"Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Firefox/24.0":                                                        true,
+}
+
+func TestLikelyTBB(t *testing.T) {
+	for k, v := range UserAgents {
+		if LikelyTBB(k) != v {
+			t.Errorf("Expected \"%s\" to be: %t", k, v)
+		}
+	}
+}





More information about the tor-commits mailing list