示例#1
0
文件: test.py 项目: pascalj/dash-apps
  def testRunAll(self):
    m = mox.Mox()

    m.StubOutWithMock(main, 'system')
    m.StubOutWithMock(main, 'read_from_file')
    m.StubOutWithMock(main, 'get_all')

    m.StubOutWithMock(main, 'get_directory')
    main.get_directory('language', 'problem', 'variation').AndReturn(
        'directory')

    main.get_all().AndReturn([('language', 'problem', 'variation')])

    main.inputs = [main.ProblemInput(10, 15, 20, 30, 40)]
    main.TIMEOUT = 99
    main.threads = [999]
    main.system(('' # 'timeout 99 ' # TODO timeout on ensisun
                 'taskset -c 0-998 '
                 '/usr/bin/time -a -f %e -o '
                 'time-language-problem-variation-0-999.out '
                 'directory/main < '
                 'problem_10_15_20_30_40.in > /dev/null 1>&0 2>&0'),
                 timeout=True)
    main.read_from_file('time-language-problem-variation-0-999.out')

    m.ReplayAll()
    main.run_all()
    m.UnsetStubs()
    m.VerifyAll()
示例#2
0
    def testRunAll(self):
        m = mox.Mox()

        m.StubOutWithMock(main, "system")
        m.StubOutWithMock(main, "read_from_file")
        m.StubOutWithMock(main, "get_all")

        m.StubOutWithMock(main, "get_directory")
        main.get_directory("language", "problem", "variation").AndReturn("directory")

        main.get_all().AndReturn([("language", "problem", "variation")])

        main.inputs = [main.ProblemInput(10, 15, 20, 30, 40)]
        main.TIMEOUT = 99
        main.threads = [999]
        main.system(
            (
                ""  # 'timeout 99 ' # TODO timeout on ensisun
                "/usr/bin/time -a -f %e -o "
                "time-language-problem-variation-0-999.out "
                "directory/main < "
                "problem_10_15_20_30_40.in > /dev/null 1>&0 2>&0"
            ),
            timeout=True,
        )
        main.read_from_file("time-language-problem-variation-0-999.out")

        m.ReplayAll()
        main.run_all()
        m.VerifyAll()
        m.UnsetStubs()
示例#3
0
文件: test.py 项目: pascalj/dash-apps
  def testMakeAll(self):
    m = mox.Mox()

    m.StubOutWithMock(main, 'system')
    main.system('cd ../../language/problem/variation && make main')

    m.StubOutWithMock(main, 'get_all')
    main.get_all().AndReturn([('language', 'problem', 'variation')])

    m.ReplayAll()
    main.make_all()
    m.UnsetStubs()
    m.VerifyAll()
示例#4
0
    def testMakeAll(self):
        m = mox.Mox()

        m.StubOutWithMock(main, "system")
        main.system("cd ../../language/problem/variation && make main")

        m.StubOutWithMock(main, "get_all")
        main.get_all().AndReturn([("language", "problem", "variation")])

        m.ReplayAll()
        main.make_all()
        m.VerifyAll()
        m.UnsetStubs()
示例#5
0
    def testGetResults(self):
        m = mox.Mox()

        m.StubOutWithMock(main, "get_all")
        main.get_all().AndReturn([("language", "problem", "variation")])

        m.StubOutWithMock(main, "read_file_values")
        main.read_file_values("time-language-problem-variation-0-999.out").AndReturn([1, 2])

        main.threads = [999]

        m.ReplayAll()
        main.get_results()
        self.assertEqual(main.results[999]["problem"]["variation"]["language"][0], (1 + 2) / 2.0)
        m.VerifyAll()
        m.UnsetStubs()
示例#6
0
文件: test.py 项目: pascalj/dash-apps
  def testGetResults(self):
    m = mox.Mox()

    m.StubOutWithMock(main, 'get_all')
    main.get_all().AndReturn([('language', 'problem', 'variation')])

    m.StubOutWithMock(main, 'read_file_values')
    main.read_file_values(
        'time-language-problem-variation-0-999.out').AndReturn([1, 2])

    main.threads = [999]

    m.ReplayAll()
    main.get_results()
    self.assertEqual(
        main.results[999]['problem']['variation']['language'][0],
        (1 + 2) / 2.)
    m.UnsetStubs()
    m.VerifyAll()