<commit_before>#!/usr/bin/python
from test_common import *

def test_function(opts, mc):
    
    print "Testing increment"
    if mc.set(str(1),str(1)) == 0:
        raise ValueError, "Set failed"
    mc.incr(str(1),10)
    if mc.get(str(1)) != str(11):
        raise ValueError, "simple increment fails, should have been 11, was", mc.get(str(1))

    # TODO: Figure out a way to test negative increments and incrementing by a very large value.
    # memcache doesn't allow either.

    print "Testing decrement"
    if mc.set(str(1),str(50)) == 0:
        raise ValueError, "Set failed"
    mc.decr(str(1),10)
    if mc.get(str(1)) != str(40):
        raise ValueError, "simple decrement fails, should have been 40, was", mc.get(str(1))

    # TODO: Figure out a way to test negative decrements and decrementing by a very large value.
    # memcache doesn't allow either.

if __name__ == "__main__":
    simple_test_main(test_function, make_option_parser().parse(sys.argv), timeout = 5)<commit_msg>Slight extension of decr test (checking underflow behavior). Added commented-out test stubs for incr overflow behavior and large number incr/decr. Both are non-functional in their current form.<commit_after>#!/usr/bin/python
from test_common import *

def test_function(opts, mc):
    
    print "Testing increment"
    if mc.set(str(1),str(1)) == 0:
        raise ValueError, "Set failed"
    mc.incr(str(1),10)
    if mc.get(str(1)) != str(11):
        raise ValueError("simple increment fails, should have been 11, was %s" % mc.get(str(1)))

    # TODO: Problem with Python not being able to handle large unsigned values in the call of incr?
    #if mc.set(str(1),str(1)) == 0:
    #    raise ValueError, "Set failed"
    #mc.incr(str(1),9223372036854775808)
    #if mc.get(str(1)) != str(9223372036854775808):
    #    raise ValueError("large number increment fails, should have been 9223372036854775808, was %s" % mc.get(str(1)))

    #if mc.set(str(1),str(9223372036854775807)) == 0:
    #    raise ValueError, "Set failed"
    #mc.incr(str(1),2)
    #mc.incr(str(1),9223372036854775807)
    #if mc.get(str(1)) != str(0):
    #    raise ValueError("overflow increment fails, should have been 0, was %s" % mc.get(str(1)))

    # TODO: Figure out a way to test negative increments and incrementing by a very large value.
    # memcache doesn't allow either.

    print "Testing decrement"
    if mc.set(str(1),str(50)) == 0:
        raise ValueError, "Set failed"
    mc.decr(str(1),10)
    if mc.get(str(1)) != str(40):
        raise ValueError("simple decrement fails, should have been 40, was %s" % mc.get(str(1)))

    # TODO: Problem with Python not being able to handle large unsigned values in the call of decr?
    #if mc.set(str(1),str(9223372036854775809)) == 0:
    #    raise ValueError, "Set failed"
    #mc.decr(str(1),9223372036854775808)
    #if mc.get(str(1)) != str(1):
    #    raise ValueError("large number decrement fails, should have been 1, was %s" % mc.get(str(1)))

    if mc.set(str(1),str(51)) == 0:
        raise ValueError, "Set failed"
    mc.decr(str(1),52)
    if mc.get(str(1)) != str(0):
        raise ValueError("underflow decrement fails, should have been 0, was %s" % mc.get(str(1)))

    # TODO: Figure out a way to test negative decrements and decrementing by a very large value.
    # memcache doesn't allow either.

if __name__ == "__main__":
    simple_test_main(test_function, make_option_parser().parse(sys.argv), timeout = 5)
{'fraction_non_alphanumeric': 0.13410071942446042, 'fraction_numerical': 0.06273381294964028, 'mean_word_length': 3.5201560468140443, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7563420', 'n_tokens_mistral': 1313, 'n_tokens_neox': 1198, 'n_words': 358}