projects
/
xonotic
/
xonotic-data.pk3dir.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f7ee0cf
)
add unit test for decibels slider
author
Rudolf Polzer <divVerent@xonotic.org>
Wed, 12 Jun 2013 11:54:14 +0000
(13:54 +0200)
committer
Rudolf Polzer <divVerent@xonotic.org>
Wed, 12 Jun 2013 11:54:14 +0000
(13:54 +0200)
qcsrc/menu/xonotic/slider_decibels.c
patch
|
blob
|
history
diff --git
a/qcsrc/menu/xonotic/slider_decibels.c
b/qcsrc/menu/xonotic/slider_decibels.c
index 6068c1c15bfde9cb9495cf3b8a74b2c2d47f3ec6..1e1f3eb75a6c194bce46dbc76139580511b3fb86 100644
(file)
--- a/
qcsrc/menu/xonotic/slider_decibels.c
+++ b/
qcsrc/menu/xonotic/slider_decibels.c
@@
-85,4
+85,19
@@
string XonoticDecibelsSlider_valueToText(entity me, float v)
return sprintf(_("%s dB"), ftos_decimals(toDecibelOfSquare(fromDecibelOfSquare(v, me.valueMin), 0), me.valueDigits));
}
+void _TEST_XonoticDecibelsSlider()
+{
+ float i;
+ for(i = -400; i < 0; ++i)
+ {
+ float db = i * 0.1;
+ float v = fromDecibelOfSquare(db, -40);
+ float dbv = toDecibelOfSquare(v, -40);
+ float d = dbv - db;
+ print(sprintf("%f -> %f -> %f (diff: %f)\n", db, v, dbv, d));
+ TEST_Check(fabs(d) > 0.02);
+ }
+ TEST_OK();
+}
+
#endif