3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-23 12:55:17 +01:00
dft_tools/test/python/Toto.py
Nils Wentzell f65e5bfbad Further cleanining, switching to static library
-Disable LINTing in test macros with comment // NOLINT
-Enable static analyzers for c++ tests
-Switch app4triqs_c to static library
 Dynamic was pickung up previously installed libapp4triqs_c.so in tests
 Also there is no need to be dynamic for applications
-Fix previous change in HeaderFilterRegex:
 'app4triqs/c++' was blocking all headers for clang-tidy checks.
 'app4triqs' works well, but we cannot install any other headers into
 app4triqs folder structure.
 We thus had to create INSTALL_DIR in travis.yml
2018-03-26 00:31:39 +02:00

43 lines
726 B
Python

#!/usr/bin/env python
import unittest
from app4triqs import Toto
from pytriqs.archive import *
from pytriqs.utility import mpi
class test_toto(unittest.TestCase):
def test_add(self):
a=Toto(0)
b=Toto(2)
c=a+b
self.assertEqual(c, b)
def test_h5(self):
a=Toto(0)
with HDFArchive("f.h5",'w') as A:
A["a"] = a
with HDFArchive("f.h5",'r') as A:
a_read = A["a"]
self.assertEqual(a, a_read)
def test_mpi(self):
a=Toto(0)
if mpi.is_master_node():
a=Toto(1)
mpi.bcast(a)
self.assertEqual(a, Toto(1))
if __name__ == '__main__':
unittest.main()