File: test-atomiclevelwidth.pas

package info (click to toggle)
xraylib 4.0.0%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 46,936 kB
  • sloc: ansic: 16,103; f90: 8,746; java: 6,766; python: 1,497; cpp: 1,305; pascal: 1,139; makefile: 809; ruby: 622; php: 594; perl: 573; cs: 193; sh: 125
file content (83 lines) | stat: -rw-r--r-- 1,593 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
program test_atomiclevelwidth;

{$APPTYPE CONSOLE}
{$mode objfpc}
{$h+}

uses xraylib, xrltest, Classes, SysUtils, fpcunit, testreport, testregistry;

type
	TestAtomicLevelWidth = class(TTestCase)
	private
		procedure _Test_bad_Z;
		procedure _Test_bad_shell;
		procedure _Test_invalid_shell;
	published
		procedure Test_Fe_K;
		procedure Test_U_N7;
		procedure Test_bad_Z;
		procedure Test_bad_shell;
		procedure Test_invalid_shell;
	end;

procedure TestAtomicLevelWidth.Test_Fe_K;
var
	width: double;
begin
	width := AtomicLevelWidth(26, K_SHELL);
	AssertEquals(1.19E-3, width, 1E-6);
end;

procedure TestAtomicLevelWidth.Test_U_N7;
var
	width: double;
begin
	width := AtomicLevelWidth(92, N7_SHELL);
	AssertEquals(0.31E-3, width, 1E-6);
end;

procedure TestAtomicLevelWidth._Test_bad_Z;
var
	width: double;
begin
	width := AtomicLevelWidth(185, N7_SHELL);
end;

procedure TestAtomicLevelWidth._Test_bad_shell;
var
	width: double;
begin
	width := AtomicLevelWidth(185, -5);
end;

procedure TestAtomicLevelWidth._Test_invalid_shell;
var
	width: double;
begin
	width := AtomicLevelWidth(23, N3_SHELL);
end;

procedure TestAtomicLevelWidth.Test_bad_Z;
begin
	AssertException(EArgumentException, @_Test_bad_Z);
end;

procedure TestAtomicLevelWidth.Test_bad_shell;
begin
	AssertException(EArgumentException, @_Test_bad_shell);
end;

procedure TestAtomicLevelWidth.Test_invalid_shell;
begin
	AssertException(EArgumentException, @_Test_invalid_shell);
end;

var
	App: TestRunner;
begin
	RegisterTest(TestAtomicLevelWidth);
	App := TestRunner.Create(nil);
	App.Initialize;
	App.Run;
	App.Free;
end.