5 * Created by Victor Grishchenko on 3/19/09.
6 * Copyright 2009 Delft University of Technology. All rights reserved.
10 #include <gtest/gtest.h>
11 //#include <glog/logging.h>
16 using namespace swift;
19 TEST(SWIFT,CwndTest) {
23 unlink("doc/sofi-copy.jpg");
25 ASSERT_EQ(0,stat("doc/sofi.jpg", &st));
26 int size = st.st_size;//, sizek = (st.st_size>>10) + (st.st_size%1024?1:0) ;
27 Channel::SELF_CONN_OK = true;
29 int sock1 = swift::Listen(7001);
30 ASSERT_TRUE(sock1>=0);
32 int file = swift::Open("doc/sofi.jpg");
33 FileTransfer* fileobj = FileTransfer::file(file);
34 //FileTransfer::instance++;
36 swift::SetTracker(Address("127.0.0.1",7001));
38 int copy = swift::Open("doc/sofi-copy.jpg",fileobj->root_hash());
40 swift::Loop(TINT_SEC);
43 while (swift::SeqComplete(copy)!=size && count++<600)
44 swift::Loop(TINT_SEC);
45 ASSERT_EQ(size,swift::SeqComplete(copy));
50 swift::Shutdown(sock1);
55 int main (int argc, char** argv) {
58 testing::InitGoogleTest(&argc, argv);
59 int ret = RUN_ALL_TESTS();