#! /usr/bin/env python

import unittest


import tbplas as tb


class MyTest(unittest.TestCase):
    def test_diag_config(self):
        config_ref = tb.DiagConfig()
        config_ref.prefix = "sample"
        config_ref.dimension = 1
        config_ref.num_spin = 5
        config_ref.save()
        config_test = tb.DiagConfig()
        self.assertNotEqual(config_test.dimension, config_ref.dimension)
        self.assertNotEqual(config_test.num_spin, config_ref.num_spin)
        config_test.load("sample")
        self.assertEqual(config_test.dimension, config_ref.dimension)
        self.assertEqual(config_test.num_spin, config_ref.num_spin)
        th = tb.TestHelper(self)
        th.test_equal_array(config_ref.k_points, config_test.k_points)
        th.test_equal_array(config_ref.ka_array, config_test.ka_array)
        th.test_equal_array(config_ref.kb_array, config_test.kb_array)

    def test_tbpm_config(self):
        config_ref = tb.TBPMConfig()
        config_ref.prefix = "sample"
        config_ref.dimension = 1
        config_ref.num_spin = 5
        config_ref.save()
        config_test = tb.TBPMConfig()
        self.assertNotEqual(config_test.dimension, config_ref.dimension)
        self.assertNotEqual(config_test.num_spin, config_ref.num_spin)
        config_test.load("sample")
        self.assertEqual(config_test.dimension, config_ref.dimension)
        self.assertEqual(config_test.num_spin, config_ref.num_spin)
        th = tb.TestHelper(self)
        th.test_equal_array(config_ref.wft_wf0, config_test.wft_wf0)


if __name__ == "__main__":
    unittest.main()
