diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-09-05 19:00:01 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-09-05 19:00:01 +0000 |
commit | 3f68c3e171fc5f572f5a7dbca685aeaa66f741a5 (patch) | |
tree | 35270d5acf5fef9a805e206b4c09b9b5675e3ad2 /src/scalarproduct/test_ecc_scalarproduct.c | |
parent | 1d89d84649d80a26ef39017d8a6f7edf5cb8d0c4 (diff) | |
download | gnunet-3f68c3e171fc5f572f5a7dbca685aeaa66f741a5.tar.gz gnunet-3f68c3e171fc5f572f5a7dbca685aeaa66f741a5.zip |
-test skeleton
Diffstat (limited to 'src/scalarproduct/test_ecc_scalarproduct.c')
-rw-r--r-- | src/scalarproduct/test_ecc_scalarproduct.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/scalarproduct/test_ecc_scalarproduct.c b/src/scalarproduct/test_ecc_scalarproduct.c new file mode 100644 index 000000000..7e0f90eae --- /dev/null +++ b/src/scalarproduct/test_ecc_scalarproduct.c | |||
@@ -0,0 +1,66 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2015 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | |||
20 | */ | ||
21 | /** | ||
22 | * @file util/test_ecc_scalarproduct.c | ||
23 | * @brief testcase for math behind ECC SP calculation | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | #include <gcrypt.h> | ||
29 | |||
30 | |||
31 | /** | ||
32 | * Perform SP calculation. | ||
33 | * | ||
34 | * @param avec 0-terminated vector of Alice's values | ||
35 | * @param bvec 0-terminated vector of Bob's values | ||
36 | * @return avec * bvec | ||
37 | */ | ||
38 | static int | ||
39 | test_sp (const unsigned int *avec, | ||
40 | const unsigned int *bvec) | ||
41 | { | ||
42 | return -1; | ||
43 | } | ||
44 | |||
45 | |||
46 | int | ||
47 | main (int argc, char *argv[]) | ||
48 | { | ||
49 | static unsigned int v11[] = { 1, 1, 0 }; | ||
50 | static unsigned int v22[] = { 2, 2, 0 }; | ||
51 | static unsigned int v35[] = { 3, 5, 0 }; | ||
52 | static unsigned int v24[] = { 2, 4, 0 }; | ||
53 | |||
54 | GNUNET_log_setup ("test-ecc-scalarproduct", | ||
55 | "WARNING", | ||
56 | NULL); | ||
57 | GNUNET_assert ( 2 == test_sp (v11, v11)); | ||
58 | GNUNET_assert ( 4 == test_sp (v22, v11)); | ||
59 | GNUNET_assert ( 8 == test_sp (v35, v11)); | ||
60 | GNUNET_assert (26 == test_sp (v35, v24)); | ||
61 | GNUNET_assert (26 == test_sp (v24, v35)); | ||
62 | GNUNET_assert (16 == test_sp (v22, v35)); | ||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | /* end of test_ecc_scalarproduct.c */ | ||