Решение на Concurrent Retry Executor от Елица Венчова

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

Към профила на Елица Венчова

Резултати

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

Код

package main
func OrderedLogDrainer(logs chan (chan string)) chan string {
result := make(chan string, 100)
go func() {
i := 0
for logEntry := range logs {
for logEntry2 := range logEntry {
msg := string(i+49) + "\t" + logEntry2
result <- msg
}
i++
}
close(result)
}()
return result
}

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

PASS
ok  	_/tmp/d20151110-19113-1g3dsht	0.003s
--- FAIL: TestWithExample1 (0.50s)
	solution_test.go:27: Test exceeded allowed time of 500 milliseconds
FAIL
exit status 1
FAIL	_/tmp/d20151110-19113-1g3dsht	0.503s
--- FAIL: TestWithExample2 (0.50s)
	solution_test.go:27: Test exceeded allowed time of 500 milliseconds
FAIL
exit status 1
FAIL	_/tmp/d20151110-19113-1g3dsht	0.503s
PASS
ok  	_/tmp/d20151110-19113-1g3dsht	0.003s
--- FAIL: TestWithTwoEmptyLogs (0.50s)
	solution_test.go:27: Test exceeded allowed time of 500 milliseconds
FAIL
exit status 1
FAIL	_/tmp/d20151110-19113-1g3dsht	0.503s
--- FAIL: TestWithDelays (0.90s)
	solution_test.go:27: Test exceeded allowed time of 400 milliseconds
	solution_test.go:27: Test exceeded allowed time of 900 milliseconds
FAIL
exit status 1
FAIL	_/tmp/d20151110-19113-1g3dsht	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-1g3dsht	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-1g3dsht	0.803s

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

Елица обнови решението на 10.11.2015 11:29 (преди над 2 години)

+package main
+
+func OrderedLogDrainer(logs chan (chan string)) chan string {
+ result := make(chan string, 100)
+ go func() {
+ for logEntry := range logs {
+ for logEntry2 := range logEntry {
+ result <- logEntry2
+ }
+ }
+ close(result)
+ }()
+ return result
+
+}

Елица обнови решението на 10.11.2015 11:30 (преди над 2 години)

package main
func OrderedLogDrainer(logs chan (chan string)) chan string {
result := make(chan string, 100)
go func() {
for logEntry := range logs {
for logEntry2 := range logEntry {
result <- logEntry2
}
}
close(result)
}()
return result
+}
+
+func main() {
}

Елица обнови решението на 10.11.2015 14:53 (преди над 2 години)

package main
func OrderedLogDrainer(logs chan (chan string)) chan string {
result := make(chan string, 100)
go func() {
+ i := 0
for logEntry := range logs {
for logEntry2 := range logEntry {
- result <- logEntry2
+ msg := string(i+49) + "\t" + logEntry2
+ result <- msg
}
+ i++
}
close(result)
}()
return result
-
-}
-
-func main() {
}