コード例 #1
0
def main():
    M_91 = M_func(100, 11, 10)

    # TEST
    is_ok(M_91.calc(101), 91, "M[91](101) == 91")

    # TEST
    is_ok(M_91.calc(91), 91, "M[91](91) == 91")

    # TEST
    ok(M_91.calc_F() == [91], "calc_F")

    # TEST
    ok(M_91.calc_SF() == long(91), "calc_SF")

    # TEST
    eq_ok(S_func(10, 10).calc(), long(225), "S(10,10)")

    # TEST
    eq_ok(S_func(1000, 1000).calc(), long(208724467), "S(1000,1000)")
コード例 #2
0
ファイル: test1.py プロジェクト: shlomif/project-euler
def main():
    M_91 = M_func(100, 11, 10)

    # TEST
    is_ok(M_91.calc(101), 91, "M[91](101) == 91")

    # TEST
    is_ok(M_91.calc(91), 91, "M[91](91) == 91")

    # TEST
    ok(M_91.calc_F() == [91], "calc_F")

    # TEST
    ok(M_91.calc_SF() == long(91), "calc_SF")

    # TEST
    eq_ok(S_func(10, 10).calc(), long(225), "S(10,10)")

    # TEST
    eq_ok(S_func(1000, 1000).calc(), long(208724467), "S(1000,1000)")
コード例 #3
0
    def input_cmd_line(self, name, cmd_line_args):

        last_arg = c_int()
        error_string = c_char_p()
        known_params = c_char_p(None)
        opened_files_dir = create_string_buffer(32001)
        diag("opened_files_dir = <%s>" % opened_files_dir)

        if False:  # (platform.system() == 'Windows'):
            import sys
            sys.exit(1)

        cmd_line_args_tuple = tuple(cmd_line_args)

        prefix = 'freecell_solver_user_cmd_line'
        func = 'parse_args_with_file_nesting_count'

        self.fcs[prefix + '_' + func](
            self.user,  # instance
            len(cmd_line_args),    # argc
            ((c_char_p * len(cmd_line_args))(
                *tuple(bytes(s, 'UTF-8') for s in cmd_line_args_tuple)
            )),  # argv
            0,   # start_arg
            byref(known_params),  # known_params
            None,   # callback
            None,   # callback_context
            byref(error_string),  # error_string
            byref(last_arg),    # last_arg
            c_int(-1),  # file_nesting_count
            opened_files_dir
        )

        # TEST:$input_cmd_line++;
        is_ok(last_arg.value, len(cmd_line_args),
              name + " - assign weights - processed two arguments")