You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

247 lines
5.7 KiB

  1. --- a/test/block.cc
  2. +++ b/test/block.cc
  3. @@ -24,9 +24,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE
  4. #include <sstream>
  5. #include <stdexcept>
  6. -int main(int, char**) {
  7. +int main(int argc, char** argv) {
  8. + char addr127001[]="127.0.0.1";
  9. + char *srvaddr;
  10. + if (argc<2)
  11. + srvaddr=addr127001;
  12. + else
  13. + srvaddr=argv[1];
  14. +
  15. try {
  16. - ipfs::Client client("localhost", 5001);
  17. + ipfs::Client client(srvaddr, 5001);
  18. /** [ipfs::Client::BlockPut] */
  19. ipfs::Json block;
  20. --- a/test/config.cc
  21. +++ b/test/config.cc
  22. @@ -23,9 +23,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE
  23. #include <iostream>
  24. #include <stdexcept>
  25. -int main(int, char**) {
  26. +int main(int argc, char** argv) {
  27. + char addr127001[]="127.0.0.1";
  28. + char *srvaddr;
  29. + if (argc<2)
  30. + srvaddr=addr127001;
  31. + else
  32. + srvaddr=argv[1];
  33. +
  34. try {
  35. - ipfs::Client client("localhost", 5001);
  36. + ipfs::Client client(srvaddr, 5001);
  37. /** [ipfs::Client::ConfigSet] */
  38. client.ConfigSet("Datastore.StorageMax", "20GB");
  39. --- a/test/dht.cc
  40. +++ b/test/dht.cc
  41. @@ -23,9 +23,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE
  42. #include <iostream>
  43. #include <stdexcept>
  44. -int main(int, char**) {
  45. +int main(int argc, char** argv) {
  46. + char addr127001[]="127.0.0.1";
  47. + char *srvaddr;
  48. + if (argc<2)
  49. + srvaddr=addr127001;
  50. + else
  51. + srvaddr=argv[1];
  52. +
  53. try {
  54. - ipfs::Client client("localhost", 5001);
  55. + ipfs::Client client(srvaddr, 5001);
  56. ipfs::Json add_result;
  57. client.FilesAdd(
  58. --- a/test/error.cc
  59. +++ b/test/error.cc
  60. @@ -35,16 +35,23 @@ extern std::string replace_body;
  61. }
  62. } // namespace ipfs
  63. -int main(int, char**) {
  64. +int main(int argc, char** argv) {
  65. + char addr127001[]="127.0.0.1";
  66. + char *srvaddr;
  67. + if (argc<2)
  68. + srvaddr=addr127001;
  69. + else
  70. + srvaddr=argv[1];
  71. +
  72. try {
  73. - ipfs::Client client_cant_connect("localhost", 57);
  74. + ipfs::Client client_cant_connect(srvaddr, 57);
  75. ipfs::test::must_fail("client.Version()", [&client_cant_connect]() {
  76. ipfs::Json version;
  77. client_cant_connect.Version(&version);
  78. });
  79. - ipfs::Client client("localhost", 5001);
  80. + ipfs::Client client(srvaddr, 5001);
  81. std::string object_id;
  82. client.ObjectNew(&object_id);
  83. --- a/test/files.cc
  84. +++ b/test/files.cc
  85. @@ -24,9 +24,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE
  86. #include <sstream>
  87. #include <stdexcept>
  88. -int main(int, char**) {
  89. +int main(int argc, char** argv) {
  90. + char addr127001[]="127.0.0.1";
  91. + char *srvaddr;
  92. + if (argc<2)
  93. + srvaddr=addr127001;
  94. + else
  95. + srvaddr=argv[1];
  96. +
  97. try {
  98. - ipfs::Client client("localhost", 5001);
  99. + ipfs::Client client(srvaddr, 5001);
  100. /** [ipfs::Client::FilesGet] */
  101. std::stringstream contents;
  102. --- a/test/generic.cc
  103. +++ b/test/generic.cc
  104. @@ -24,16 +24,23 @@ CONNECTION WITH THE SOFTWARE OR THE USE
  105. #include <stdexcept>
  106. #include <utility>
  107. -int main(int, char**) {
  108. +int main(int argc, char** argv) {
  109. + char addr127001[]="127.0.0.1";
  110. + char *srvaddr;
  111. + if (argc<2)
  112. + srvaddr=addr127001;
  113. + else
  114. + srvaddr=argv[1];
  115. +
  116. try {
  117. /** [ipfs::Client::Client] */
  118. - ipfs::Client client("localhost", 5001);
  119. + ipfs::Client client(srvaddr, 5001);
  120. /** [ipfs::Client::Client] */
  121. ipfs::Client clientA(client);
  122. clientA = client;
  123. ipfs::Client clientB(std::move(clientA));
  124. - ipfs::Client clientC("localhost", 5001);
  125. + ipfs::Client clientC(srvaddr, 5001);
  126. clientC = std::move(clientB);
  127. #pragma GCC diagnostic push
  128. --- a/test/key.cc
  129. +++ b/test/key.cc
  130. @@ -26,9 +26,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE
  131. using Json = nlohmann::json;
  132. -int main(int, char**) {
  133. +int main(int argc, char** argv) {
  134. + char addr127001[]="127.0.0.1";
  135. + char *srvaddr;
  136. + if (argc<2)
  137. + srvaddr=addr127001;
  138. + else
  139. + srvaddr=argv[1];
  140. +
  141. try {
  142. - ipfs::Client client("localhost", 5001);
  143. + ipfs::Client client(srvaddr, 5001);
  144. /** [ipfs::Client::KeyGen] */
  145. std::string key_id;
  146. --- a/test/name.cc
  147. +++ b/test/name.cc
  148. @@ -24,9 +24,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE
  149. #include <sstream>
  150. #include <stdexcept>
  151. -int main(int, char**) {
  152. +int main(int argc, char** argv) {
  153. + char addr127001[]="127.0.0.1";
  154. + char *srvaddr;
  155. + if (argc<2)
  156. + srvaddr=addr127001;
  157. + else
  158. + srvaddr=argv[1];
  159. +
  160. try {
  161. - ipfs::Client client("localhost", 5001);
  162. + ipfs::Client client(srvaddr, 5001);
  163. // We need a key here, so as not to clobber the "self" key.
  164. std::string key_id;
  165. --- a/test/object.cc
  166. +++ b/test/object.cc
  167. @@ -24,9 +24,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE
  168. #include <stdexcept>
  169. #include <string>
  170. -int main(int, char**) {
  171. +int main(int argc, char** argv) {
  172. + char addr127001[]="127.0.0.1";
  173. + char *srvaddr;
  174. + if (argc<2)
  175. + srvaddr=addr127001;
  176. + else
  177. + srvaddr=argv[1];
  178. +
  179. try {
  180. - ipfs::Client client("localhost", 5001);
  181. + ipfs::Client client(srvaddr, 5001);
  182. /** [ipfs::Client::ObjectNew] */
  183. std::string object_id;
  184. --- a/test/pin.cc
  185. +++ b/test/pin.cc
  186. @@ -23,9 +23,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE
  187. #include <stdexcept>
  188. #include <string>
  189. -int main(int, char**) {
  190. +int main(int argc, char** argv) {
  191. + char addr127001[]="127.0.0.1";
  192. + char *srvaddr;
  193. + if (argc<2)
  194. + srvaddr=addr127001;
  195. + else
  196. + srvaddr=argv[1];
  197. +
  198. try {
  199. - ipfs::Client client("localhost", 5001);
  200. + ipfs::Client client(srvaddr, 5001);
  201. std::string object_id;
  202. --- a/test/swarm.cc
  203. +++ b/test/swarm.cc
  204. @@ -23,9 +23,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE
  205. #include <stdexcept>
  206. #include <string>
  207. -int main(int, char**) {
  208. +int main(int argc, char** argv) {
  209. + char addr127001[]="127.0.0.1";
  210. + char *srvaddr;
  211. + if (argc<2)
  212. + srvaddr=addr127001;
  213. + else
  214. + srvaddr=argv[1];
  215. +
  216. try {
  217. - ipfs::Client client("localhost", 5001);
  218. + ipfs::Client client(srvaddr, 5001);
  219. /** [ipfs::Client::SwarmAddrs] */
  220. ipfs::Json addresses;