import tensorflow as tf
import numpy as np

class JoinLabelsTest(tf.test.TestCase):
    def runTest(self):
        members = set(dir(self.__class__)) - set(dir(tf.test.TestCase))
        members.remove('runTest')
        rList = []
        for mem in members:
            rList.append(eval('self.' + mem + '()'))
        return rList
    # def joinIntsTest(self):
    #     ts1 = tf.constant([1, 2, 3])
    #     ts2 = tf.constant([0,2,4,5 ])
    #     ts3 = tf.constant([ 0,1,2,3,4,5])
    #     # ts1 = tf.cast(ts1, tf.int64)
    #     # ts2 = tf.cast(ts2, tf.int64)
    #     # ts3 = tf.cast(ts3, tf.int64)
    #     result = tf.user_ops.join_labels([ts1, ts2])
    #     eqs= tf.equal(result, ts3)
    #     isEqual = tf.reduce_all(eqs)
    #     with tf.Session() as sess:
    #         print sess.run(isEqual)
    def joinStringsTest(self):
        ts1 = tf.constant(["ab", "c", "d"])
        ts2 = tf.constant(["a","b","c","e" ])
        ts3 = tf.constant([ "a","ab", "b","c","d","e"])
        ts4 = tf.constant([], tf.string)

        result = tf.user_ops.join_labels([ts1, ts2, ts3, ts4])
        with tf.Session() as sess:
            print sess.run(result) == np.array([ "a","ab", "b","c","d","e"])


if __name__ == "__main__":
    test = JoinLabelsTest()
    testList = test.runTest()
