Sha256: f78bc8ddb396faaa6625e61127b93a1b825dd9bc889aa9a275e5a1b8588774ff
Contents?: true
Size: 999 Bytes
Versions: 7
Compression:
Stored size: 999 Bytes
Contents
#! /usr/bin/env ruby # coding: utf-8 require "helper" class VaspUtils::Potcar::Concatenater public :dump end class TC_Concatenater < Test::Unit::TestCase def setup settings = VaspUtils::Setting.new("test/potcar/test.vasputils") potcar_path = settings["potcar_path"] elem_potcar = settings["element_potcar"] @c = VaspUtils::Potcar::Concatenater.new(potcar_path, elem_potcar) end def test_dump # concatenating assert_equal( "H\n" , @c.dump(["H"])) assert_equal( "H\nLi_sv\n", @c.dump(["H", "Li"])) assert_raise(VaspUtils::Potcar::Concatenater::NoPotcarError){@c.dump(["H", "Li", "not_exist_element"])} # return string if io is nil. assert_equal( "H\n", @c.dump(["H"], nil)) # write io outfile = "test/potcar/tmp.POTCAR" FileUtils.rm(outfile) if File.exist? outfile File.open(outfile, "w") { |io| @c.dump(["H"], io) } assert_equal( "H\n", File.read(outfile)) FileUtils.rm(outfile) if File.exist? outfile end end
Version data entries
7 entries across 7 versions & 1 rubygems