config_test.go raw

   1  package config
   2  
   3  //
   4  // func TestForEach(t *testing.T) {
   5  // 	c := GetConfigs()
   6  // 	c.ForEach(
   7  // 		func(ifc opt.Option) bool {
   8  // 			switch ii := ifc.(type) {
   9  // 			case *binary.Opt:
  10  // 				t.Log(spew.Sdump(ii.Data))
  11  // 			case *list.Opt:
  12  // 				t.Log(spew.Sdump(ii.Data))
  13  // 			case *float.Opt:
  14  // 				t.Log(spew.Sdump(ii.Data))
  15  // 			case *integer.Opt:
  16  // 				t.Log(spew.Sdump(ii.Data))
  17  // 			case *text.Opt:
  18  // 				t.Log(spew.Sdump(ii.Data))
  19  // 			case *duration.Opt:
  20  // 				t.Log(spew.Sdump(ii.Data))
  21  // 			default:
  22  // 				// t.Log(spew.Sdump(ii))
  23  // 			}
  24  // 			return true
  25  // 		},
  26  // 	)
  27  // }
  28  //
  29  // func TestMarshalUnmarshal(t *testing.T) {
  30  // 	c := podcfg.GetDefaultConfig()
  31  // 	// d := GetDefaultConfig()
  32  // 	// c.ShowAll = true
  33  // 	// I.S(c)
  34  // 	c.MinRelayTxFee.Set(0.3352)
  35  // 	c.UUID.Set(int(rand.Int63()))
  36  // 	c.Username = c.Username.Set("aoeuaoeu")
  37  // 	b, e := json.MarshalIndent(c, "", "    ")
  38  // 	if e != nil {
  39  // 		t.Fatal(e)
  40  // 	}
  41  // 	t.Log("\n" + string(b))
  42  // 	// c.MinRelayTxFee.Set(0.99999)
  43  // 	// // t.Log("\n" + string(b))
  44  // 	// c.UUID.Set(int(rand.Int63()))
  45  // 	// if e = json.Unmarshal(b, d); E.Chk(e) {
  46  // 	// }
  47  // 	// c.UUID.Set(int(rand.Int63()))
  48  // 	// c.NodeOff.Set(true)
  49  // 	// c.Username = c.Username.Set("qwertyuiop")
  50  // 	// c.AddPeers.Set([]string{"a", "b", "c"})
  51  // 	// b, e = json.MarshalIndent(c, "", "    ")
  52  // 	// if e != nil {
  53  // 	// 	t.Fatal(e)
  54  // 	// }
  55  // 	// t.Log("\n" + string(b))
  56  // 	// c.AddPeers.Set([]string{"hello", "world"})
  57  // 	// c.BanDuration.Set(69*time.Microsecond + time.Hour*5)
  58  // 	// c.MinRelayTxFee.Set(0.03)
  59  // 	// c.Username = c.Username.Set("123412341234")
  60  // 	// // t.Log("\n" + string(b))
  61  // 	// if e = json.Unmarshal(b, c); E.Chk(e) {
  62  // 	// }
  63  // 	// // I.S(c)
  64  // 	// // d, _ := EmptyConfig()
  65  // 	// c.Username = c.Username.Set("testingtesting")
  66  // 	// c.NodeOff.Set(true)
  67  // 	// c.MinRelayTxFee.Set(1.1)
  68  // 	// b, e = json.MarshalIndent(d, "", "    ")
  69  // 	// if e != nil {
  70  // 	// 	t.Fatal(e)
  71  // 	// }
  72  // 	// t.Log("\n" + string(b))
  73  // 	// if e = json.Unmarshal(b, d); E.Chk(e) {
  74  // 	// }
  75  // 	// c.AddPeers.Set([]string{"one", "two", "three"})
  76  // 	// c.BanDuration.Set(69*time.Millisecond + time.Second*5)
  77  // 	// b, e = json.MarshalIndent(d, "", "    ")
  78  // 	// if e != nil {
  79  // 	// 	t.Fatal(e)
  80  // 	// }
  81  // 	// t.Log("\n" + string(b))
  82  // 	// b, e = json.MarshalIndent(c, "", "    ")
  83  // 	// if e != nil {
  84  // 	// 	t.Fatal(e)
  85  // 	// }
  86  // 	// c.UUID.Set(int(rand.Int63()))
  87  // 	// if e = json.Unmarshal(b, c); E.Chk(e) {
  88  // 	// }
  89  // 	// // I.Ln("b")
  90  // 	// I.S(c)
  91  // 	// if e = json.Unmarshal(b, d); E.Chk(e) {
  92  // 	// }
  93  // }
  94  //
  95  // func TestDefaultConfig(t *testing.T) {
  96  // 	c := podcfg.GetDefaultConfig()
  97  // 	// I.S(c)
  98  // 	var e error
  99  // 	var cm *Command
 100  // 	var depth, dist int
 101  // 	var found bool
 102  // 	if found, depth, dist, cm, e = c.Commands.Find("drophistory", depth, dist); !podcfg.E.Chk(e) || found {
 103  // 		podcfg.I.F("found %v depth %d dist %d \n%s\n%v", found, depth, dist, spew.Sdump(cm), e)
 104  // 	}
 105  // }
 106