Esempio n. 1
0
def main(targets):
    '''
    Runs the main project pipeline logic, given the targets.
    targets must contain: 'data', 'analysis', 'model'. 
    
    `main` runs the targets in order of data=>analysis=>model.
    '''

    if 'test' in targets:
        run_tests()

    if 'data' in targets:
        with open('config/etl-params/etl-params.json') as fh:
            etl_cfg = json.load(fh)

        run_etl(**etl_cfg)

    if 'analysis' in targets:
        with open('config/analysis-params/analysis-params.json') as fh:
            analysis_cfg = json.load(fh)

        generate_analysis(**analysis_cfg)

    if 'report' in targets:
        with open('config/report-params.json') as fh:
            analysis_cfg = json.load(fh)
        convert_notebook(**analysis_cfg)

    if 'model' in targets:
        with open('config/model-params/model-params.json') as fh:
            model_cfg = json.load(fh)
        # make the data target
        train(**model_cfg)
    return
Esempio n. 2
0
def all_test(options = {}):
	tests = [\
		test_map_pixel_to_pixel,\
		test_map_neighborhood_to_pixel,\
		test_map_image_to_pixel,\
		test_map_image_to_object\
	]
	return run_tests(tests, options)
Esempio n. 3
0
def all_test(options = {}):
    tests = [\
	test_register_value_fetch,\
	test_neg,\
	test_xor_reg_clear,\
        test_lid,\
	test_sleep_wakeup,\
	test_sleep_wakeup2,\
    ]
    return run_tests(tests, options)
Esempio n. 4
0
def all_test(options = {}):
    tests = [\
        test_bbs,\
        test_threshold,\
        test_threshold2,\
        test_copy_to_out,\
	test_const_gray,\
	test_gen_invert_im,\
    ]
    return run_tests(tests, options)
def all_test(options = {}):
	tests = [\
		test_gray,\
		test_treshold,\
		test_conv_3x1,\
		test_get2D_func,\
		test_conv_3x1_multiple_block,\
		test_conv_3x3_multiple_block,\
	]
	return run_tests(tests, options)
Esempio n. 6
0
def all_test(options = {}):
	tests = [\
		test_gen_apply_sparse_filter,\
		test_gen_gather_local_max,\
		test_gen_global_max,\
		test_gen_abs_value,\
		test_gen_calc_planarity,\
		test_gen_calc_planarity_opt,\
		test_intern_image2buffer_func,\
		test_gen_calc_planarity_inlined,\
		test_gen_calc_planarity_inlined_opt,\
	]
	return run_tests(tests, options)
Esempio n. 7
0
    def start(self):
        if self.__DEBUGGING_MODE:
            run_tests()

        self.__services.preload_list()
        self.__ui_manager.show_help()

        while True:
            action = self.__ui_manager.get_action()

            try:
                if action.type == constants.ACTION_ADD:
                    result = self.__services.add(action.params)
                    self.__ui_manager.print_result(result)

                elif action.type == constants.ACTION_ERROR:
                    self.__ui_manager.on_invalid_command()

                elif action.type == constants.ACTION_EXIT:
                    return

                elif action.type == constants.ACTION_FILTER_ABOVE:
                    result = self.__services.filter_above(action.params)
                    self.__ui_manager.print_result(result)

                elif action.type == constants.ACTION_HELP:
                    self.__ui_manager.show_help()

                elif action.type == constants.ACTION_LIST_ALL:
                    result = self.__services.list_all()
                    self.__ui_manager.print_result(result)

                elif action.type == constants.ACTION_UNDO:
                    result = self.__services.undo_last_action()
                    self.__ui_manager.print_result(result)
            except ValidationError as error:
                self.__ui_manager.handle_error(error)
Esempio n. 8
0
def all_test(options = {}):
	tests = [\
		test_alloc_release_reg,\
		test_load_function,\
		test_load_function_from_hierarchic_module,\
		test_get_codegen_parameters,\
		test_is_valid_codegen,\
		test_scoped_alloc,\
		test_nested_scoped_alloc,\
		test_scoped_alloc_in_codegen,\
		test_convert_code_to_compact_repr,\
		test_convert_compact_repr_to_obj,\
		test_instr_adapter_attrs,\
	]
	return run_tests(tests, options)
def all_test(options = {}):
	tests = [test_split_filter_correctness, \
		 test_split_filter_invalid_blocksize,\
		 test_all_points_in_same_block,\
		 test_neighbouring_blocks,\
		 gen_integral_image_correctness,\
		 test_full_integral_image_correctness,\
	 	 test_integral_sum, \
		 test_gen_fullintegral_sum2_2,\
		 test_fullintegral_sum, \
		 test_single_variance_calculation,\
		 #test_no_manual_alloc,\
		 #gen_faces_detect_no_errors, \
		 test_detect_faces_fullintegral,\
		 test_detect_faces\
		 #test_compare_implementations\
	]
	return run_tests(tests, options)
def test_fuzzy_agent(num_tests=NUM_TESTS, hyper_params={'verbose': False}):
    """ Test the fuzzy agent """
    stats = []
    filename = None
    for test in range(num_tests):
        print("***** Test: " + str(test))
        probs, mars = gen_probs()
        print("For probs:", probs)
        env = env_tr.Environment(FuzzyAgent(mars=mars, **hyper_params))
        generate_test_set(num_tests=1, num_steps=NUM_STEPS, probs=probs)
        stats.append({'probs': probs, 'stats':run_tests(env, num_tests=1)})
        if test % 50 == 0:
            # Save states
            filename = pickle_dump(stats, filename)
    if num_tests == 1:
        print(stats)
    else:
        pickle_dump(stats, filename)
        plot_stats(stats)
Esempio n. 11
0
def all_test(options = {}):
	tests = [\
		test_tracefragment_insert_before,\
		test_tracefragment_insert_after,\
		test_tracefragment_remove_current_instr,\
		test_no_optimiser_artifacts,\
		test_imm_pass_1,\
		test_imm_pass_2,\
		test_memory_pass_1,\
		test_memory_pass_2,\
		test_memory_pass_3,\
		test_convert_to_ssa_easy,\
		test_convert_to_ssa_ports,\
		test_convert_to_ssa_mov_phi,\
		test_convert_to_ssa_instr_phi,\
		test_convert_to_ssa_mov_phi_long,\
		test_convert_to_ssa_vj_no_errors,\
		test_no_compiler_optimiser_artifacts,\
		test_get_allocation_ranges,\
	]
	return run_tests(tests, options)
Esempio n. 12
0
def test_perceptron():
	global W
	for i in range(3, 6):
		set_w_bayes()
		run_tests(test)
		alpha = 10 ** (- i)
		print "Testing perceptron with naive Bayesian prior, alpha =", alpha
		train(alpha, EPOCHS)
		run_tests(test)

	for i in range(3, 6):
		set_w_zero()
		alpha = 10 ** (- i)
		print "Testing perceptron with zero prior, alpha =", alpha
		train(alpha, EPOCHS)
		run_tests(test)
Esempio n. 13
0
def all_test(options = {}):
	tests = [\
		test_undefined_variable_detection,\
		test_resolve_seq_values,\
		test_compile_add,\
		test_compile_conditional,\
		test_simple_loop_noseq,\
		test_simple_loop,\
		test_simple_loop_emit_noseq,\
		test_simple_loop_emit,\
		test_inplace_operator,\
		test_replace_phi_nodes,\
		test_builtin_loadwest,\
		test_builtin_sendout,\
		test_builtin_transfer,\
		test_th_code,\
		test_const_array_access,\
		test_delayed_memderef,\
		test_delayed_memderef2,\
		test_memderef_inside_condassign,\
		test_logic_variable,\
		test_logic_variable2,\
		test_phi_codegen,\
		test_jmp_codegen,\
		test_patch_arguments,\
		test_patch_reg_arguments,\
		test_conv_code_noseq,\
		test_2D_const_list,\
		test_peephole_addorsub_zero,\
		test_peephole_twoconstant_sources,\
		test_get2D,\
		test_get2D_copy_propagation,\
		test_replace_regnames_by_tmp_names,\
		test_liveness_analysis,\
		test_register_allocator_leave_special_regs,\
	]
	return run_tests(tests, options)
Esempio n. 14
0
      (
          "haruka",
          "chihaya",
          "yayoi",
          "iori",
          "yukiho",
          "makoto",
          "ami",
          "mami",
          "azusa",
          "miki",
          "hibiki",
          "takane",
          "ritsuko",
      )], 1300),
    #Your custom test goes here:
    #( [ , ], None ),
]


def isTestDisabled(i):
    return False


#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(LiveConcert, 'maxHappiness', TEST_CASES, isTestDisabled,
                     1477350719, 250, CASE_TIME_OUT, tester.COMPACT_REPORT)
# CUT end
Esempio n. 15
0
        4,
    ), 30, 5], 150),
    ([(
        9,
        4,
    ), 10, 5], 105),
    ([(
        51,
        1,
        77,
        14,
        17,
        10,
        80,
    ), 32, 40], 12096),
    #Your custom test goes here:
    #( [ , , ], None ),
]


def isTestDisabled(i):
    return False


#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(TheShuttles, 'getLeastCost', TEST_CASES, isTestDisabled,
                     1476906089, 250, CASE_TIME_OUT, tester.COMPACT_REPORT)
# CUT end
Esempio n. 16
0
    def mod(self, n):
        return n % 555555555


# CUT begin
#-------------------------------------------------------------------------------
CASE_TIME_OUT = 2.0

TEST_CASES = [
    ([5, 1], 2),
    ([5, 2], 2),
    ([10, 4], 65),
    ([314, 78], 498142902),
    ([555, 222], 541606281),
    #Your custom test goes here:
    #( [ , ], None ),
]


def isTestDisabled(i):
    return False


#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(MuddyRoad2, 'theCount', TEST_CASES, isTestDisabled,
                     1474319721, 955, CASE_TIME_OUT, tester.COMPACT_REPORT)
# CUT end
Esempio n. 17
0
    ), 12], 4),
    ([(
        ".................",
        ".ooooooo...oooo..",
        ".ooooooo..oooooo.",
        ".oo.......oo..oo.",
        ".oo.......oo..oo.",
        ".ooooo.....oooo..",
        ".ooooooo...oooo..",
        ".....ooo..oo..oo.",
        "......oo..oo..oo.",
        ".ooooooo..oooooo.",
        ".oooooo....oooo..",
        ".................",
    ), 58], 6),
    #Your custom test goes here:
    #( [ , ], None ),
]


def isTestDisabled(i):
    return False


#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(DropCoins, 'getMinimum', TEST_CASES, isTestDisabled,
                     1474236047, 600, CASE_TIME_OUT, tester.COMPACT_REPORT)
# CUT end
def run_cron():
    import tester
    tester.run_tests()
    return 'OK'
Esempio n. 19
0

# CUT begin
#-------------------------------------------------------------------------------
CASE_TIME_OUT = 2.0

TEST_CASES = [
    #( [ 4, "UUDD" ], 1 ),
    #( [ 4, "DUUD" ], 0 ),
    #( [ 4, "UU" ], 1 ),
    #( [ 49, "U" ], 0 ),
    #( [ 20, "UUUDUUU" ], 990 ),
    ([6, "UDU"], 2),
    #( [ 30, "DUDUDUDUDUDUDUDU" ], 3718 ),
    #( [ 50, "U" ], 946357703 ),
    #Your custom test goes here:
    #( [ , ], None ),
]


def isTestDisabled(i):
    return False


#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(FoxAndMountain, 'count', TEST_CASES, isTestDisabled,
                     1475536338, 1000, CASE_TIME_OUT, tester.COMPACT_REPORT)
# CUT end
        g.add_registered_player('123', p1)
        g.add_registered_player('33', p2)
        g.add_registered_player('34', p3)
        x = g.get_players_hash()
        x['123'].give_card(cards.Card('h8'))
        x['123'].give_card(cards.Card('h7'))
        x['123'].make_defender()
        x['33'].make_defender()
        x['34'].make_attacker()
        self.testing_module = server_generator
        self.test_Server_Generator = [
                                      [s, 'skip_response', ['OK', 'No message'], 'status:ok\nmessage:No message'],
                                      [s, 'quit_response', ['OK', 'Missed game'], 'status:ok\nmessage:Missed game'],
                                      [s, 'retransfer_response', ['OK', 'Bla'], 'status:ok\nmessage:Bla'],
                                      [s, 'take_response', ['OK', 'Bla2'], 'status:ok\nmessage:Bla2'],
                                      [s, 'cover_response', ['OK', 'Bla3'], 'status:ok\nmessage:Bla3'],
                                      [s, 'attack_response', ['OK', 'Bla4'], 'status:ok\nmessage:Bla4'],
                                      [s, 'join_game_response', ['OK', 'Bla5'], 'status:ok\nmessage:Bla5'],
                                      [s, 'create_game_response', ['OK', 'Bla6'], 'status:ok\nmessage:Bla6'],
                                      [s, 'register_response', ['OK', 'Bla7', '738'], 'status:ok\nmessage:Bla7\nuid:738'],
                                      [s, 'list_of_games_response', [gs],
                                       '''game:"game1"(Riva)(Teddy)(Yahel){numberOfPlayers5}{attack6Cards}\ngame:"game2"(Riva)(Teddy)(Yahel){numberOfPlayers3}{firstAttack5Cards}{canRetransfer}'''],
                                      [s, 'get_game_status_response', ['ok', 'mes', 'game', g, '123'],
                                       '''status:ok\nmessage:mes\ngame:game\ntable:[h0]\ndeck:[36]\ntrump:[cA]\nout:[h8]\noptions:{numberOfPlayers4}{attack6Cards}{canRetransfer}\nplayer:1(Teddy)_defender_[h8][h7]\nplayer:2(Yahel)_defender_[0]\nplayer:3(Riva)_attacker_[0]\nactive:1'''
                                       ]
                                      ]
        self.class_names = ['Server_Generator']

tester = Test()
tester.run_tests()
Esempio n. 21
0
        1,
    )], 1.6666666666666667),
    ([(
        1,
        -1,
        1,
    )], 2.0),
    ([(
        1,
        0,
    )], 0.0),
    ([(
        -1,
        -1,
    )], 2.0),
    #Your custom test goes here:
    #( [ ], None ),
]


def isTestDisabled(i):
    return False


#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(PrinceXToastbook, 'eat', TEST_CASES, isTestDisabled,
                     1476955802, 925, CASE_TIME_OUT, tester.COMPACT_REPORT)
# CUT end
Esempio n. 22
0
        best = min(best, count)
        print i, best
    return best


# CUT begin
#-------------------------------------------------------------------------------
CASE_TIME_OUT = 2.0;

TEST_CASES = [
    ( [ (1,2,4,), 7 ], 1 ),
    ( [ (1,2,4,7,8,), 7 ], 2 ),
    ( [ (12571295,2174218,2015120,), 1 ], 0 ),
    ( [ (5,2,4,52,62,9,8,3,1,11,6,), 11 ], 3 ),
    ( [ (503,505,152,435,491,512,1023,355,510,500,502,255,63,508,509,511,60,250,254,346,), 510 ], 5 ),
    #Your custom test goes here:
    #( [ , ], None ),
]

def isTestDisabled(i):
    return False

#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(
        ORSolitaireDiv2, 'getMinimum', TEST_CASES, isTestDisabled, 
        1476906811, 600, CASE_TIME_OUT, tester.COMPACT_REPORT
    )
# CUT end
Esempio n. 23
0
                return i
        return q


# CUT begin
#-------------------------------------------------------------------------------
CASE_TIME_OUT = 2.0

TEST_CASES = [
    ([3], 3),
    ([1729], 7),
    ([561], 3),
    ([7], 7),
    ([341], 3),
    ([31859], 31859),
    #Your custom test goes here:
    #( [ ], None ),
]


def isTestDisabled(i):
    return False


#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(PseudoPrimeTest, 'firstFail', TEST_CASES, isTestDisabled,
                     1474599754, 600, CASE_TIME_OUT, tester.COMPACT_REPORT)
# CUT end
Esempio n. 24
0
                out += 1
        return out


# CUT begin
#-------------------------------------------------------------------------------
CASE_TIME_OUT = 2.0

TEST_CASES = [
    (["L"], 0),
    (["RRR"], 0),
    (["LRLRLR"], 2),
    (["LLLRRR"], 0),
    (["RLRLRL"], 3),
    #Your custom test goes here:
    #( [ ], None ),
]


def isTestDisabled(i):
    return False


#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(LeftAndRightHandedDiv2, 'count', TEST_CASES,
                     isTestDisabled, 1475567981, 250, CASE_TIME_OUT,
                     tester.COMPACT_REPORT)
# CUT end
Esempio n. 25
0
class PowersOfTwo:

  def count(self, powers):
    return 0

# CUT begin
#-------------------------------------------------------------------------------
CASE_TIME_OUT = 2.0;

TEST_CASES = [
    ( [ (1,2,) ], 4 ),
    ( [ (1,1,1,1,) ], 5 ),
    ( [ (1,2,2,2,4,4,16,) ], 32 ),
    ( [ (1,32,1,16,32,) ], 18 ),
    ( [ (1048576,1073741824,549755813888,70368744177664,4398046511104,262144,1048576,2097152,8796093022208,1048576,1048576,35184372088832,2097152,256,256,256,262144,1048576,1048576,70368744177664,262144,1048576,) ], 18432 ),
    #Your custom test goes here:
    #( [ ], None ),
]

def isTestDisabled(i):
    return False

#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(
        PowersOfTwo, 'count', TEST_CASES, isTestDisabled, 
        1475570865, 1000, CASE_TIME_OUT, tester.COMPACT_REPORT
    )
# CUT end
Esempio n. 26
0
'''
Created on Aug 15, 2013

@author: Mike
'''

import tester

if __name__ == '__main__':
    tester.run_tests("HungerGames.py")
Esempio n. 27
0
def all_test(options={}):
    tests = [test_codesection_profiler, test_communication_profiler, test_opcode_profiler]
    return run_tests(tests, options)
Esempio n. 28
0
def all_test(options = {}):
	tests = []
	return run_tests(tests, options)
Esempio n. 29
0
        "..",
        "WW",
    )], "YES"),
    ([(
        ".WWWW.",
        "WWWWWW",
    )], "NO"),
    ([(
        ".W.W.W.",
        "W.W.W.W",
    )], "YES"),
    ([(
        ".............................................W.",
        ".............................................W.",
    )], "NO"),
    #Your custom test goes here:
    #( [ ], None ),
]


def isTestDisabled(i):
    return False


#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(RainyRoad, 'isReachable', TEST_CASES, isTestDisabled,
                     1474235436, 250, CASE_TIME_OUT, tester.COMPACT_REPORT)
# CUT end
Esempio n. 30
0
    [test_create_order, True],
    [test_get_all_orders, True],
    [test_get_requested_orders, True],
    [test_get_requested_and_cooking_orders, True],
]

valid_order_id = None


def get_valid_order_id():
    global valid_order_id
    if valid_order_id:
        return valid_order_id
    valid_order_req = session.post(api_url + "create_order",
                                   json={
                                       "table_num": 1,
                                       "items": [1]
                                   })
    valid_order_id = valid_order_req.json().get("data")["order_id"]
    return valid_order_id


if __name__ == "__main__":
    if len(sys.argv) > 1 and sys.argv[1] == "v":
        verbose = True
    total = 0
    passed = 0
    failed = []
    total, passed, failed = tester.run_tests(tests, total, passed, failed)
    tester.print_results(total, passed, failed)
Esempio n. 31
0
            for j in range(i + 1, a + 1):
                out += j * (1.0 / total)
        return out


# CUT begin
#-------------------------------------------------------------------------------
CASE_TIME_OUT = 2.0

TEST_CASES = [
    ([2, 2], 2.0),
    ([4, 2], 3.2),
    ([3, 3], 2.6666666666666665),
    ([11, 13], 7.999999999999999),
    #Your custom test goes here:
    #( [ , ], None ),
]


def isTestDisabled(i):
    return False


#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(FixedDiceGameDiv2, 'getExpectation', TEST_CASES,
                     isTestDisabled, 1476994786, 500, CASE_TIME_OUT,
                     tester.COMPACT_REPORT)
# CUT end
Esempio n. 32
0
          68,
      ),
      ("VK=4EN+6GZ+8IG", "EN=3VZ", "IG=8VZ+2GZ", "JZ=7IG+9SE+2VZ+4EN+1EJ",
       "VZ=8VB", "VK=1GZ+6SE+5VK+7JZ+8EJ", "SE=4JI+6VB+9VB+4HB+8EN",
       "EN=3HB+8VB+3EJ+1GZ+8VB", "IG=1IG+2EN+7JI+1GZ+5EJ",
       "VB=6HB+9VK+2VB+1HB+9VK", "VB=2JZ+4OI+3GZ+4HB+8JI",
       "GZ=8OI+5VZ+5HB+2VZ+9EJ", "GZ=1EJ+1JI+2HB+4JZ+9JZ", "GZ=5JI+1VZ",
       "EN=7OI+5VZ+6HB+6GZ+6JI", "GZ=9GZ+5EJ+2HB+6HB+2JI",
       "GZ=7JI+7HB+7HB+9JZ+4JZ", "IG=1EJ+3SE+4VB+4HB+3EN", "LOVE=2EN+2JZ+3GZ",
       "IG=4VB+8SE+4GZ+4JI+4GZ", "VB=1VK+2VK+3JI+6JZ+7OI",
       "VK=3HB+8JZ+2EJ+3SE+7GZ", "SE=8OI+5SE+2HB+8JI+3EN",
       "JZ=6EN+7EJ+1IG+9EJ+4VZ", "IG=2EJ+4VB+6VB", "VK=1VZ+7SE+6VZ+5JI+3JZ",
       "VZ=5HB+1EJ")], 5744),
    #( [ ("WATER",), (1,), ("LOVE=1LOVE",) ], -1 ),
    #( [ ("MILK","WATER","HOP",), (6,1,14,), ("NECTAR=4HOP+2MILK","LOVE=5MILK+3BEER","LOVE=2WATER+1LOVE","LOVE=2MIX+1NECTAR","MIX=1MILK+1WATER+1HOP","BEER=5WATER+2HOP","LOVE=1NECTAR+3WATER+3HOP","NECTAR=3BEER+1MILK+2MILK",) ], 110 ),
    #Your custom test goes here:
    #( [ , , ], None ),
]


def isTestDisabled(i):
    return False


#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(MakingPotions, 'getCost', TEST_CASES, isTestDisabled,
                     1476398824, 1000, CASE_TIME_OUT, tester.COMPACT_REPORT)
# CUT end
Esempio n. 33
0
class Bracket107:
    def yetanother(self, s):
        return 0


# CUT begin
#-------------------------------------------------------------------------------
CASE_TIME_OUT = 2.0

TEST_CASES = [
    (["(())"], 1),
    (["(())()"], 3),
    (["()()()"], 3),
    (["(((())))"], 5),
    (["((())())"], 9),
    #Your custom test goes here:
    #( [ ], None ),
]


def isTestDisabled(i):
    return False


#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(Bracket107, 'yetanother', TEST_CASES, isTestDisabled,
                     1477446841, 250, CASE_TIME_OUT, tester.COMPACT_REPORT)
# CUT end
Esempio n. 34
0
        1593,
        1799,
        1805,
        1139,
        1493,
        1141,
        1163,
        1211,
    )], -1),
    ([(
        2,
        3,
        7,
        19,
    )], -1),
    #Your custom test goes here:
    #( [ ], None ),
]


def isTestDisabled(i):
    return False


#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(ANDEquation, 'restoreY', TEST_CASES, isTestDisabled,
                     1476671984, 250, CASE_TIME_OUT, tester.COMPACT_REPORT)
# CUT end
Esempio n. 35
0
  def describeIntersection(self, A, B):
    return ""

# CUT begin
#-------------------------------------------------------------------------------
CASE_TIME_OUT = 2.0;

TEST_CASES = [
    ( [ (0,0,3,2,), (1,1,5,3,) ], "rectangle" ),
    ( [ (0,0,5,3,), (1,2,2,3,) ], "rectangle" ),
    ( [ (1,1,6,2,), (3,2,5,4,) ], "segment" ),
    ( [ (0,1,2,3,), (2,0,5,2,) ], "segment" ),
    ( [ (0,0,1,1,), (1,1,5,2,) ], "point" ),
    ( [ (1,1,2,2,), (3,1,4,2,) ], "none" ),
    #Your custom test goes here:
    #( [ , ], None ),
]

def isTestDisabled(i):
    return False

#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(
        TwoRectangles, 'describeIntersection', TEST_CASES, isTestDisabled, 
        1476674739, 550, CASE_TIME_OUT, tester.COMPACT_REPORT
    )
# CUT end
Esempio n. 36
0
          return (i, j, x2)
    return None


# CUT begin
#-------------------------------------------------------------------------------
CASE_TIME_OUT = 2.0;

TEST_CASES = [
    ( [ 6 ], (2,2,2,) ),
    ( [ 11 ], (2,3,5,) ),
    ( [ 0 ], (7,10,-70,) ),
    ( [ 500 ], (-400,-3,-700,) ),
    ( [ 2 ], (2,2,-2,) ),
    ( [ 5 ], (5,2,-5,) ),
    #Your custom test goes here:
    #( [ ], None ),
]

def isTestDisabled(i):
    return False

#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(
        AddMultiply, 'makeExpression', TEST_CASES, isTestDisabled, 
        1475475610, 250, CASE_TIME_OUT, tester.COMPACT_REPORT
    )
# CUT end
Esempio n. 37
0
	ret = get_best (Y)
	return ret

def test_string (s):
	sentence = []
	for word in s.split():
		sentence.append (clean (word))
	print sentence
	return test (sentence)

print "Reading Input..."
read_input ()
N = len (word_list) + 1 # size of feature vector
W = numpy.mat (numpy.zeros((NUM_AUTHORS, N)))
NUM_WORDS = len(word_list)

print "Training Bayes..."
train_bayes()
setW()
#print "Normalizing W"
#normalize ()
print "Training..."
train()

print test_string ("To be, or not to be")
print test_string ("Oh what a rouge and peasant slave am i")
print test_string ("Macbeth")

print "Testing..."
run_tests(test)
Esempio n. 38
0
      if letters[a] != blah:
        return -1
    return best_ducks

# CUT begin
#-------------------------------------------------------------------------------
CASE_TIME_OUT = 2.0;

TEST_CASES = [
    ( [ "quqacukqauackck" ], 2 ),
    ( [ "kcauq" ], -1 ),
    ( [ "quackquackquackquackquackquackquackquackquackquack" ], 1 ),
    ( [ "qqqqqqqqqquuuuuuuuuuaaaaaaaaaacccccccccckkkkkkkkkk" ], 10 ),
    ( [ "quqaquuacakcqckkuaquckqauckack" ], 3 ),
    ( [ "quackqauckquack" ], -1 ),
    #Your custom test goes here:
    #( [ ], None ),
]

def isTestDisabled(i):
    return False

#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(
        Quacking, 'quack', TEST_CASES, isTestDisabled, 
        1472370045, 500, CASE_TIME_OUT, tester.COMPACT_REPORT
    )
# CUT end
Esempio n. 39
0
        7,
        2,
        15,
    ), (
        -1,
        -1,
        4,
        -1,
        11,
        3,
        13,
        -1,
        -1,
        18,
    )], 8.0),
    #Your custom test goes here:
    #( [ , ], None ),
]


def isTestDisabled(i):
    return False


#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(GreaterGame, 'calc', TEST_CASES, isTestDisabled,
                     1414077265, 250, CASE_TIME_OUT, tester.COMPACT_REPORT)
# CUT end
Esempio n. 40
0
            total += 1
        if b >= n:
            total += 1
        return total


# CUT begin
#-------------------------------------------------------------------------------
CASE_TIME_OUT = 2.0

TEST_CASES = [
    ([1, 1, 1, 2], 2),
    ([2, 1, 1, 2], 2),
    ([1, 2, 3, 2], 3),
    ([4, 7, 7, 4], 5),
    #Your custom test goes here:
    #( [ , , , ], None ),
]


def isTestDisabled(i):
    return False


#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(TheBoredomDivTwo, 'find', TEST_CASES, isTestDisabled,
                     1474772925, 250, CASE_TIME_OUT, tester.COMPACT_REPORT)
# CUT end
Esempio n. 41
0
        1,
        1,
        1,
        1,
        1,
        1,
        2,
        2,
        2,
        2,
        2,
        2,
    )], "POSSIBLE"),
    ([1, (1, )], "POSSIBLE"),
    #Your custom test goes here:
    #( [ , ], None ),
]


def isTestDisabled(i):
    return False


#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(IncrementingSequence, 'canItBeDone', TEST_CASES,
                     isTestDisabled, 1475475889, 500, CASE_TIME_OUT,
                     tester.COMPACT_REPORT)
# CUT end
Esempio n. 42
0
def all_test(options = {}):
	tests = [\
		test_local_max,\
		test_elementwise_max,\
	]
	return run_tests(tests, options)
Esempio n. 43
0
    if out == self.MAX:
      return -1
    return out

# CUT begin
#-------------------------------------------------------------------------------
CASE_TIME_OUT = 2.0;

TEST_CASES = [
    ( [ "101101101" ], 3 ),
    ( [ "1111101" ], 1 ),
    ( [ "00000" ], -1 ),
    ( [ "110011011" ], 3 ),
    ( [ "1000101011" ], -1 ),
    ( [ "111011100110101100101110111" ], 5 ),
    #Your custom test goes here:
    #( [ ], None ),
]

def isTestDisabled(i):
    return False

#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(
        CuttingBitString, 'getmin', TEST_CASES, isTestDisabled, 
        1474318444, 555, CASE_TIME_OUT, tester.COMPACT_REPORT
    )
# CUT end
Esempio n. 44
0
def all_test(options = {}):
	tests = [\
		test_imm_instr,
        test_add_instr,
	]
	return run_tests(tests, options)
Esempio n. 45
0
 def test_tester(self):
     import tester
     tester.run_tests('Player.py')       
Esempio n. 46
0
class SuccessiveSubtraction2:

  def calc(self, a, p, v):
    return ()

# CUT begin
#-------------------------------------------------------------------------------
CASE_TIME_OUT = 2.0;

TEST_CASES = [
    ( [ (1,2,3,4,5,), (1,2,0,4,3,), (3,9,-10,5,1,) ], (10,16,5,5,2,) ),
    ( [ (-100,-100,-100,-100,-100,), (0,1,2,3,4,), (0,0,0,0,0,) ], (400,300,200,100,0,) ),
    ( [ (83,0,25,21,), (0,3,2,1,3,1,2,), (10,-90,33,52,-100,0,45,) ], (56,125,133,81,91,143,155,) ),
    ( [ (1,), (0,0,0,0,), (10,-10,100,-100,) ], (10,-10,100,-100,) ),
    ( [ (-11,-4,28,38,21,-29,-45,11,-58,-39,92,35,-56,-6,29,-2,61,10,-29,-63,), (19,5,3,10,4,18,5,2,0,15,), (-19,21,7,-66,38,-39,-22,24,-32,13,) ], (451,443,412,440,457,467,468,464,443,458,) ),
    #Your custom test goes here:
    #( [ , , ], None ),
]

def isTestDisabled(i):
    return False

#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(
        SuccessiveSubtraction2, 'calc', TEST_CASES, isTestDisabled, 
        1427335095, 450, CASE_TIME_OUT, tester.COMPACT_REPORT
    )
# CUT end
Esempio n. 47
0
                    continue
                smallest = min(smallest, int(''.join(new_num)))
        return smallest


# CUT begin
#-------------------------------------------------------------------------------
CASE_TIME_OUT = 2.0

TEST_CASES = [
    (["596"], "569"),
    (["93561"], "13569"),
    (["5491727514"], "1491727554"),
    (["10234"], "10234"),
    (["93218910471211292416"], "13218910471211292496"),
    #Your custom test goes here:
    #( [ ], None ),
]


def isTestDisabled(i):
    return False


#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(SwappingDigits, 'minNumber', TEST_CASES, isTestDisabled,
                     1477520633, 250, CASE_TIME_OUT, tester.COMPACT_REPORT)
# CUT end
Esempio n. 48
0
          score += board[i][j] == "0"
        else:
          score += board[i][j] == "1"
    return score

# CUT begin
#-------------------------------------------------------------------------------
CASE_TIME_OUT = 2.0;

TEST_CASES = [
    ( [ ("101","010","101",) ], 9 ),
    ( [ ("111","111","111",) ], 5 ),
    ( [ ("0101001","1101011",) ], 9 ),
    ( [ ("000","001","010","011","100","101","110","111",) ], 15 ),
    ( [ ("000000000000000000000000","011111100111111001111110","010000000100000001000000","010000000100000001000000","010000000100000001000000","011111100111111001111110","000000100000001000000010","000000100000001000000010","000000100000001000000010","011111100111111001111110","000000000000000000000000",) ], 105 ),
    #Your custom test goes here:
    #( [ ], None ),
]

def isTestDisabled(i):
    return False

#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(
        XorBoardDivTwo, 'theMax', TEST_CASES, isTestDisabled, 
        1474317988, 255, CASE_TIME_OUT, tester.COMPACT_REPORT
    )
# CUT end
Esempio n. 49
0
        if verts >= y_diff and horizs >= x_diff:
            return "Explosion"
        return "Safe"


# CUT begin
#-------------------------------------------------------------------------------
CASE_TIME_OUT = 2.0

TEST_CASES = [
    ([1, 0, 2, 0, "L"], "Explosion"),
    ([1, 0, 2, 0, "U"], "Safe"),
    ([1, 0, 2, 0, "UL"], "Explosion"),
    ([3, 3, 5, 5, "LURLL"], "Safe"),
    ([10, 5, -9, -10, "LULULULLLUULRULULULULULULLULULLULD"], "Explosion"),
    #Your custom test goes here:
    #( [ , , , , ], None ),
]


def isTestDisabled(i):
    return False


#-------------------------------------------------------------------------------
if __name__ == '__main__':
    import sys, tester
    tester.run_tests(ExplodingRobots, 'canExplode', TEST_CASES, isTestDisabled,
                     1473918748, 500, CASE_TIME_OUT, tester.COMPACT_REPORT)
# CUT end