Решение на Concurrent Retry Executor от Ива Зарева

Обратно към всички решения

Към профила на Ива Зарева

Резултати

  • 0 точки от тестове
  • 0 бонус точки
  • 0 точки общо
  • 0 успешни тест(а)
  • 8 неуспешни тест(а)

Код

package main
import (
"strconv"
)
func OrderedLogDrainer(logs chan (chan string)) chan string {
result := make(chan string, 100)
for temp := range logs {
i := 1
for x := range temp {
stri := strconv.Itoa(i) + "\t"
x = stri + x
result <- x
}
i = i + 1
}
close(result)
return result
}

Лог от изпълнението

--- FAIL: TestWithOneMessage (0.50s)
	solution_test.go:27: Test exceeded allowed time of 500 milliseconds
FAIL
exit status 1
FAIL	_/tmp/d20151110-19113-i3281f	0.504s
--- FAIL: TestWithExample1 (0.50s)
	solution_test.go:27: Test exceeded allowed time of 500 milliseconds
FAIL
exit status 1
FAIL	_/tmp/d20151110-19113-i3281f	0.504s
--- FAIL: TestWithExample2 (0.50s)
	solution_test.go:27: Test exceeded allowed time of 500 milliseconds
FAIL
exit status 1
FAIL	_/tmp/d20151110-19113-i3281f	0.503s
--- FAIL: TestWithNoLogs (0.50s)
	solution_test.go:27: Test exceeded allowed time of 500 milliseconds
FAIL
exit status 1
FAIL	_/tmp/d20151110-19113-i3281f	0.503s
--- FAIL: TestWithTwoEmptyLogs (0.50s)
	solution_test.go:27: Test exceeded allowed time of 500 milliseconds
FAIL
exit status 1
FAIL	_/tmp/d20151110-19113-i3281f	0.503s
--- FAIL: TestWithDelays (0.90s)
	solution_test.go:27: Test exceeded allowed time of 900 milliseconds
FAIL
exit status 1
FAIL	_/tmp/d20151110-19113-i3281f	0.903s
--- FAIL: TestTheLimits (0.50s)
	solution_test.go:27: Test exceeded allowed time of 500 milliseconds
FAIL
exit status 1
FAIL	_/tmp/d20151110-19113-i3281f	0.503s
--- FAIL: TestWithManyLogs (0.80s)
	solution_test.go:27: Test exceeded allowed time of 800 milliseconds
FAIL
exit status 1
FAIL	_/tmp/d20151110-19113-i3281f	0.804s

История (1 версия и 1 коментар)

Ива обнови решението на 09.11.2015 23:04 (преди над 2 години)

+package main
+
+import (
+ "strconv"
+)
+
+func OrderedLogDrainer(logs chan (chan string)) chan string {
+ result := make(chan string, 100)
+ for temp := range logs {
+ i := 1
+ for x := range temp {
+ stri := strconv.Itoa(i) + "\t"
+ x = stri + x
+ result <- x
+ }
+ i = i + 1
+ }
+ close(result)
+ return result
+}