<commit_before>//
//  SynchronizedResolverSpec.swift
//  Swinject
//
//  Created by <NAME> on 11/23/15.
//  Copyright © 2015 Swinject Contributors. All rights reserved.
//

import Quick
import Nimble
@testable import Swinject

class SynchronizedResolverSpec: QuickSpec {
    override func spec() {
        describe("Multiple threads") {
            it("can resolve circular dependencies.") {
                let container = Container() { container in
                    container.register(ParentType.self) { _ in Parent() }
                        .initCompleted { r, s in
                            let parent = s as! Parent
                            parent.child = r.resolve(ChildType.self)
                        }
                        .inObjectScope(.graph)
                    container.register(ChildType.self) { _ in Child() }
                        .initCompleted { r, s in
                            let child = s as! Child
                            child.parent = r.resolve(ParentType.self)!
                        }
                        .inObjectScope(.graph)
                }.synchronize()
                <commit_msg>Explicitly import Dispatch for DispatchQueue to support Linux.<commit_after>//
//  SynchronizedResolverSpec.swift
//  Swinject
//
//  Created by <NAME> on 11/23/15.
//  Copyright © 2015 Swinject Contributors. All rights reserved.
//

import Dispatch
import Quick
import Nimble
@testable import Swinject

class SynchronizedResolverSpec: QuickSpec {
    override func spec() {
        describe("Multiple threads") {
            it("can resolve circular dependencies.") {
                let container = Container() { container in
                    container.register(ParentType.self) { _ in Parent() }
                        .initCompleted { r, s in
                            let parent = s as! Parent
                            parent.child = r.resolve(ChildType.self)
                        }
                        .inObjectScope(.graph)
                    container.register(ChildType.self) { _ in Child() }
                        .initCompleted { r, s in
                            let child = s as! Child
                            child.parent = r.resolve(ParentType.self)!
                        }
                        .inObjectScope(.graph)
                }.synchronize()
                
{'fraction_non_alphanumeric': 0.08520559559135227, 'fraction_numerical': 0.00847816871555744, 'mean_word_length': 1.293488824101069, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5520389', 'n_tokens_mistral': 584, 'n_tokens_neox': 536, 'n_words': 151}