# Path: ariba/flag.py
# class Error (Exception): pass
# class Flag:
#     def __init__(self, n=0):
#     def set_flag(self, n):
#     def add(self, f):
#     def to_number(self):
#     def __eq__(self, other):
#     def __str__(self):
#     def to_long_string(self):
#     def has(self, s):
#     def to_comma_separated_string(self):


import unittest
import os
from ariba import flag

modules_dir = os.path.dirname(os.path.abspath(flag.__file__))
data_dir = os.path.join(modules_dir, 'tests', 'data')

class TestFlag(unittest.TestCase):
    def test_init_and_to_number(self):
        '''Test __init__ and to_number'''
        for i in range(512):
            f = flag.Flag(i)
            self.assertEqual(f.to_number(), i)


    def test_set_flag(self):
        '''Test set_flag'''
        for i in range(512):
            f = flag.Flag()
            f.set_flag(i)
            self.assertEqual(f.to_number(), i)


    def test_add(self):
        '''Test add'''
        f = flag.Flag()
        expected = [1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047]
        for i in range(len(flag.flags_in_order)):

# Path: ariba/flag.py
# class Error (Exception): pass
# class Flag:
#     def __init__(self, n=0):
#     def set_flag(self, n):
#     def add(self, f):
#     def to_number(self):
#     def __eq__(self, other):
#     def __str__(self):
#     def to_long_string(self):
#     def has(self, s):
#     def to_comma_separated_string(self):


# Path: ariba/tests/flag_test.py
import unittest
import os
from ariba import flag


modules_dir = os.path.dirname(os.path.abspath(flag.__file__))
data_dir = os.path.join(modules_dir, 'tests', 'data')

class TestFlag(unittest.TestCase):
    def test_init_and_to_number(self):
        '''Test __init__ and to_number'''
        for i in range(512):
            f = flag.Flag(i)
            self.assertEqual(f.to_number(), i)


    def test_set_flag(self):
        '''Test set_flag'''
        for i in range(512):
            f = flag.Flag()
            f.set_flag(i)
            self.assertEqual(f.to_number(), i)


    def test_add(self):
        '''Test add'''
        f = flag.Flag()
        expected = [1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047]
        for i in range(len(flag.flags_in_order)):

            f.add(flag.flags_in_order[i])