Exemplo n.º 1
0
  def borderCrossChronos(self):
    # Some do 1 test
    # Some dont test
    # Some start but dont finish
    # Some finish after expected time

    print("---- Chrono #1 ----")
    self.morningChrono.startSession()
    self.morningChrono.simTimeTrial(2, 19, 20, self.fake1['id'], self.chrono['id'], doNotStart=1, doNotFinish=1, startShift=10)

    print("---- Chrono #2 ----")
    self.morningChrono.simTimeTrial(2, 19, 20, self.fake1['id'], self.chrono['id'], doNotStart=2, doNotFinish=2, startShift=45)
    self.morningTest.endSession()

    print("---- Chrono Results ----")
    # ---- Results ----
    # ---- Checks - Asserts ----
    friMorningChronoLaps = getLapsForSession(self.morningChrono.session['id'])
    checkLaps(friMorningChronoLaps, 160 - 6, {1: 78, 2: 76}, {1: 2})

    friMorningChronoBests = getBestLapsForSession(self.morningChrono.session['id'])
    checkBestLaps(friMorningChronoBests, 78, {}, {1: 2})

    friMorningChronoResults = getResultsForSession(self.morningChrono.session['id'])
    checkResults(friMorningChronoResults, 80, {0: 2}, {0: 2})
Exemplo n.º 2
0
    def borderCrossQP(self):
        # descente dans le boarder cross
        # Border cross
        # deux runs d essais (controle transpondeurs)
        # deux runs chronos
        # le meilleur retenu

        print("---- Test #1 ----")
        self.morningTest.startSession()
        self.morningTest.simTimeTrial(2,
                                      19,
                                      20,
                                      self.fake1['id'],
                                      self.chrono['id'],
                                      doNotStart=1,
                                      doNotFinish=1)
        print("---- Test #2 ----")
        self.morningTest.simTimeTrial(2,
                                      19,
                                      20,
                                      self.fake1['id'],
                                      self.chrono['id'],
                                      doNotStart=2,
                                      doNotFinish=2,
                                      startShift=30)
        # We forget to stop that one
        self.morningTest.endSession()

        print("---- Tests Results ----")
        friMorningTestsLaps = getLapsForSession(self.morningTest.session['id'])
        checkLaps(friMorningTestsLaps, 160 - 6, {1: 78, 2: 76}, {1: 2})

        friMorningTestsLapsElite = getLapsForSession(
            self.morningTest.session['id'],
            self.championship.eliteCategory['id'])
        checkLaps(friMorningTestsLapsElite, 60 - 6, {
            1: 28,
            2: 26
        }, {1: 2}, self.championship.eliteCategory['name'])

        friMorningTestsBests = getBestLapsForSession(
            self.morningTest.session['id'])
        printLaps(friMorningTestsBests, True)
        checkBestLaps(friMorningTestsBests, 78, {}, {1: 2})
        #  ---- Determine startup ----

        friMorningTestsResults = getResultsForSession(
            self.morningTest.session['id'])
        # TODO Have chart with startup list
        # TODO Check if it should count points
        checkResults(friMorningTestsResults, 80, {}, {1: 4})

        beaconsStartOrder = []
        for i in reversed(range(30)):
            self.morningChrono.addPilot(friMorningTestsResults[i]['pilot'])
        for i in range(30, 80):
            self.morningChrono.addPilot(friMorningTestsResults[i]['pilot'])
Exemplo n.º 3
0
    def testDerby(self):
        print("---- Derby of Sunday morning ----")
        self.sunDerby2Elite.startSession()
        self.sunDerby2Elite.simRace(3, 10, self.chrono['id'])
        self.sunDerby2Elite.endSession()
        print("---- Tests Results of " + self.sunDerby2Elite.session['name'] +
              "----")
        checkLaps(getLapsForSession(self.sunDerby2Elite.session['id']),
                  len(self.elitePilots), {1: len(self.elitePilots)},
                  {1: len(self.elitePilots)}, 'Elite', 180000, 190000)
        checkBestLaps(getBestLapsForSession(self.sunDerby2Elite.session['id']),
                      len(self.elitePilots), {1: len(self.elitePilots)},
                      {1: len(self.elitePilots)}, 'Elite', 180000, 190000)
        checkResults(getResultsForSession(self.sunDerby2Elite.session['id']),
                     len(self.elitePilots), {1: len(self.elitePilots)},
                     {1: len(self.elitePilots)}, 'Elite', 180000, 190000)

        self.sunDerby2Open.startSession()
        self.sunDerby2Open.simRace(3, 20, self.chrono['id'])
        # We forget to end that one
        #self.sunDerby2Open.endSession()
        print("---- Tests Results of " + self.sunDerby2Open.session['name'] +
              "----")
        checkLaps(getLapsForSession(self.sunDerby2Open.session['id']),
                  len(self.openPilots), {1: len(self.openPilots)},
                  {1: len(self.openPilots)}, 'Open', 180000, 200000)
        checkBestLaps(getBestLapsForSession(self.sunDerby2Open.session['id']),
                      len(self.openPilots), {1: len(self.openPilots)},
                      {1: len(self.openPilots)}, 'Open', 180000, 200000)
        checkResults(getResultsForSession(self.sunDerby2Open.session['id']),
                     len(self.openPilots), {1: len(self.openPilots)},
                     {1: len(self.openPilots)}, 'Open', 180000, 200000)

        self.sunDerby2Woman.startSession()
        self.sunDerby2Woman.simRace(3, 30, self.chrono['id'])
        self.sunDerby2Woman.endSession()
        checkLaps(getLapsForSession(self.sunDerby2Woman.session['id']),
                  len(self.womanPilots), {1: len(self.womanPilots)},
                  {1: len(self.womanPilots)}, 'Woman', 180000, 210000)
        checkBestLaps(getBestLapsForSession(self.sunDerby2Woman.session['id']),
                      len(self.womanPilots), {1: len(self.womanPilots)},
                      {1: len(self.womanPilots)}, 'Woman', 180000, 210000)
        checkResults(getResultsForSession(self.sunDerby2Woman.session['id']),
                     len(self.womanPilots), {1: len(self.womanPilots)},
                     {1: len(self.womanPilots)}, 'Woman', 180000, 210000)

        self.sunDerby2Junior.startSession()
        self.sunDerby2Junior.simRace(3, 40, self.chrono['id'])
        self.sunDerby2Junior.endSession()
        checkLaps(getLapsForSession(self.sunDerby2Junior.session['id']),
                  len(self.juniorPilots), {1: len(self.juniorPilots)},
                  {1: len(self.juniorPilots)}, 'Junior', 180000, 220000)
        checkBestLaps(
            getBestLapsForSession(self.sunDerby2Junior.session['id']),
            len(self.juniorPilots), {1: len(self.juniorPilots)},
            {1: len(self.juniorPilots)}, 'Junior', 180000, 220000)
        checkResults(getResultsForSession(self.sunDerby2Junior.session['id']),
                     len(self.juniorPilots), {1: len(self.juniorPilots)},
                     {1: len(self.juniorPilots)}, 'Junior', 180000, 220000)
Exemplo n.º 4
0
    def test(self):
        self.satDerby1Elite.startSession()
        self.satDerby1Elite.simRace(3, 10, self.chrono['id'])
        self.satDerby1Elite.endSession()
        print("---- Tests Results of " + self.satDerby1Elite.session['name'] +
              "----")
        checkLaps(getLapsForSession(self.satDerby1Elite.session['id']),
                  len(self.elitePilots), {1: len(self.elitePilots)},
                  {1: len(self.elitePilots)}, 'Elite', 180000, 190000)
        checkBestLaps(getBestLapsForSession(self.satDerby1Elite.session['id']),
                      len(self.elitePilots), {1: len(self.elitePilots)},
                      {1: len(self.elitePilots)}, 'Elite', 180000, 190000)
        checkResults(getResultsForSession(self.satDerby1Elite.session['id']),
                     len(self.elitePilots), {1: len(self.elitePilots)},
                     {1: len(self.elitePilots)}, 'Elite', 180000, 190000)

        self.satDerby1Open.startSession()
        self.satDerby1Open.simRace(3, 20, self.chrono['id'])
        self.satDerby1Open.endSession()
        print("---- Tests Results of " + self.satDerby1Open.session['name'] +
              "----")
        checkLaps(getLapsForSession(self.satDerby1Open.session['id']),
                  len(self.openPilots), {1: len(self.openPilots)},
                  {1: len(self.openPilots)}, 'Open', 180000, 200000)
        checkBestLaps(getBestLapsForSession(self.satDerby1Open.session['id']),
                      len(self.openPilots), {1: len(self.openPilots)},
                      {1: len(self.openPilots)}, 'Open', 180000, 200000)
        checkResults(getResultsForSession(self.satDerby1Open.session['id']),
                     len(self.openPilots), {1: len(self.openPilots)},
                     {1: len(self.openPilots)}, 'Open', 180000, 200000)

        self.satDerby1Woman.startSession()
        self.satDerby1Woman.simRace(3, 30, self.chrono['id'])
        self.satDerby1Woman.endSession()
        checkLaps(getLapsForSession(self.satDerby1Woman.session['id']),
                  len(self.womanPilots), {1: len(self.womanPilots)},
                  {1: len(self.womanPilots)}, 'Woman', 180000, 210000)
        checkBestLaps(getBestLapsForSession(self.satDerby1Woman.session['id']),
                      len(self.womanPilots), {1: len(self.womanPilots)},
                      {1: len(self.womanPilots)}, 'Woman', 180000, 210000)
        checkResults(getResultsForSession(self.satDerby1Woman.session['id']),
                     len(self.womanPilots), {1: len(self.womanPilots)},
                     {1: len(self.womanPilots)}, 'Woman', 180000, 210000)

        self.satDerby1Junior.startSession()
        self.satDerby1Junior.simRace(3, 40, self.chrono['id'])
        self.satDerby1Junior.endSession()
        checkLaps(getLapsForSession(self.satDerby1Junior.session['id']),
                  len(self.juniorPilots), {1: len(self.juniorPilots)},
                  {1: len(self.juniorPilots)}, 'Junior', 180000, 220000)
        checkBestLaps(
            getBestLapsForSession(self.satDerby1Junior.session['id']),
            len(self.juniorPilots), {1: len(self.juniorPilots)},
            {1: len(self.juniorPilots)}, 'Junior', 180000, 220000)
        checkResults(getResultsForSession(self.satDerby1Junior.session['id']),
                     len(self.juniorPilots), {1: len(self.juniorPilots)},
                     {1: len(self.juniorPilots)}, 'Junior', 180000, 220000)
Exemplo n.º 5
0
 def runSessions(self, qualified, sessions):
   results = []
   print("---- Dual " + str(len(sessions)) + "th finale ----")
   for i in range(0, len(sessions)):
     session = sessions[i]
     session.addPilot(qualified[2 * i]['pilot'])
     session.addPilot(qualified[2 * i + 1]['pilot'])
     session.startSession()
     session.simRace(1, 10, self.chrono['id'], 0)
     session.endSession()
     # We keep winner
     sessionResults = getResultsForSession(session.session['id'])
     results.append(sessionResults[0])
     print("---- Tests Results of " + session.session['name'] + "----")
     checkLaps(getLapsForSession(session.session['id']), 2, {1: 2}, {1: 2})
     checkBestLaps(getBestLapsForSession(session.session['id']), 2, {1: 2}, {1: 2})
     checkResults(sessionResults, 2, {1: 2}, {1: 2})
   return results
Exemplo n.º 6
0
    def test(self):
        # -------------------------------------
        #vendredi apres midi	boarder cross	boarder cross	départ à 4 ou 6	?	?
        # Quel ordre de départ? Comment sont déterminés les groupes?
        # -------------------------------------

        # -- 1/16 th - 16 x 5
        print("---- 1 / 16 th ----")
        # Order from results of morning
        morningChrono = getSessionByName('Friday am Chrono')
        friMorningChronoResults = getResultsForSession(morningChrono['id'])
        for i in range(0, 80):
            session = self.friPm16Sessions[(i % 16)]
            session.addPilot(friMorningChronoResults[i]['pilot'])

        sessionIndex = 0
        for s in self.friPm16Sessions:
            session = s.session
            # We keep best
            s.startSession()
            s.simRace(2, 30, self.chronos[-1]['id'], 0)
            s.endSession()
            sessionIndex += 1
        friPm16SessionsResults = []
        for s in self.friPm16Sessions:
            sessionResults = getResultsForSession(s.session['id'])
            friPm16SessionsResults.append(sessionResults)
            print("---- Tests Results of " + s.session['name'] + "----")
            checkLaps(getLapsForSession(s.session['id']), 5, {1: 5}, {1: 5})
            checkBestLaps(getBestLapsForSession(s.session['id']), 5, {1: 5},
                          {1: 5})
            checkResults(sessionResults, 5, {1: 5}, {1: 5})

        # -- 1/8 th - 8 x 6
        print("---- 1 / 8 th ----")
        sessionIndex = 0
        for s in self.friPm8Sessions:
            session = s.session
            # We keep best
            addBestsOfSessions(friPm16SessionsResults[2 * sessionIndex],
                               friPm16SessionsResults[(2 * sessionIndex) + 1],
                               3, s)
            s.startSession()
            s.simRace(2, 30, self.chronos[-1]['id'], 1)
            # We forget to end that one
            # s.endSession()
            sessionIndex += 1
        friPm8SessionsResults = []
        for s in self.friPm8Sessions:
            sessionResults = getResultsForSession(s.session['id'])
            friPm8SessionsResults.append(sessionResults)
            print("---- Tests Results of " + s.session['name'] + "----")
            checkLaps(getLapsForSession(s.session['id']), 5, {1: 5}, {1: 5})
            checkBestLaps(getBestLapsForSession(s.session['id']), 5, {1: 5},
                          {1: 5})
            # Because we skipped the endSession, the unfinished laps still looks ongoing
            checkResults(sessionResults, 6, {1: 6}, {1: 6})

        # -- 1/4 th - 4 x 6
        print("---- 1 / 4 th ----")
        sessionIndex = 0
        for s in self.friPm4Sessions:
            session = s.session
            # We keep best
            addBestsOfSessions(friPm8SessionsResults[2 * sessionIndex],
                               friPm8SessionsResults[(2 * sessionIndex) + 1],
                               3, s)
            s.startSession()
            s.simRace(2, 30, self.chronos[-1]['id'], 1)
            s.endSession()
            sessionIndex += 1
        friPm4SessionsResults = []
        for s in self.friPm4Sessions:
            sessionResults = getResultsForSession(s.session['id'])
            friPm4SessionsResults.append(sessionResults)
            print("---- Tests Results of " + s.session['name'] + "----")
            checkLaps(getLapsForSession(s.session['id']), 5, {1: 5}, {1: 5})
            checkBestLaps(getBestLapsForSession(s.session['id']), 5, {1: 5},
                          {1: 5})
            checkResults(sessionResults, 6, {1: 5}, {1: 5})

        # -- 1/2 th - 2 x 6
        print("---- 1 / 2 th ----")
        sessionIndex = 0
        for s in self.friPmSemiSessions:
            session = s.session
            # We keep best
            addBestsOfSessions(friPm4SessionsResults[2 * sessionIndex],
                               friPm4SessionsResults[(2 * sessionIndex) + 1],
                               3, s)
            s.startSession()
            s.simRace(2, 30, self.chronos[-1]['id'], 1)
            s.endSession()
            sessionIndex += 1
        friPmSemiSessionsResults = []
        for s in self.friPmSemiSessions:
            sessionResults = getResultsForSession(s.session['id'])
            friPmSemiSessionsResults.append(sessionResults)
            print("---- Tests Results of " + s.session['name'] + "----")
            checkLaps(getLapsForSession(s.session['id']), 5, {1: 5}, {1: 5})
            checkBestLaps(getBestLapsForSession(s.session['id']), 5, {1: 5},
                          {1: 5})
            checkResults(sessionResults, 6, {1: 5}, {1: 5})

        # -- Finale - 1 x 6
        print("---- Finale ----")
        # We keep best
        addBestsOfSessions(friPmSemiSessionsResults[0],
                           friPmSemiSessionsResults[1], 3, self.friPmFinale)
        self.friPmFinale.startSession()
        self.friPmFinale.simRace(2, 30, self.chronos[-1]['id'])
        self.friPmFinale.endSession()
        print("---- Tests Results of " + self.friPmFinale.session['name'] +
              "----")
        checkLaps(getLapsForSession(self.friPmFinale.session['id']), 6, {1: 6},
                  {1: 6})
        checkBestLaps(getBestLapsForSession(self.friPmFinale.session['id']), 6,
                      {1: 6}, {1: 6})
        checkResults(getResultsForSession(self.friPmFinale.session['id']), 6,
                     {1: 6}, {1: 6})