     private var passedFlashcards = 0
     private var index = 0
     private var numberOfFlashcardsInFullDeck : Int
+    private let testType : NumberOfQuestions
+    private let cardsInTest : Int
     
-    init(deck : [Flashcard]) {
+    init(deck : [Flashcard], testType : NumberOfQuestions) {
         
         self.deck = deck
         self.numberOfFlashcardsInFullDeck = deck.count
+        self.testType = testType
+        
+        switch testType {
+        case .Learn:
+            cardsInTest = deck.count
+        case .Test(let questionsNumber):
+            if questionsNumber > uint(deck.count) {
+                cardsInTest = deck.count
+            } else {
+                cardsInTest = Int(questionsNumber)
+            }
+        }
         currentFlashcard()
     }
     

        
        var rand : Int
        
        if(deck.count == 0) {
            
            currentCard = nil
        }


import Foundation

enum NumberOfQuestions {
    
    case Test(uint), Learn
}

class Test {
    
    private var deck : [Flashcard]
