<commit_before>package frame

import (
	cv "github.com/glycerine/goconvey/convey"
	"testing"
	"time"
)

func TestParsingTMFRAME(t *testing.T) {
	cv.Convey("Given that we have a timestamp and a string message, we should be able to assemble and parse the TMFRAME message.", t, func() {

		tm := time.Now()
		msg := []byte("fake msg")
		pti := PtiUDE
		utyp := Utf8
		frame := NewFrame(tm, pti, utyp, 0, 0, msg)

		nano := tm.UnixNano()
		low3 := nano % 8

		cv.So(frame.Tm, cv.ShouldEqual, nano-low3)
		cv.So(string(frame.Data), cv.ShouldEqual, string(msg))
		cv.So(frame.Ulen, cv.ShouldEqual, len(msg))
		cv.So(frame.Ulen, cv.ShouldEqual, len(frame.Data))
		cv.So(frame.IsUser, cv.ShouldEqual, false)
		cv.So(frame.Pti, cv.ShouldEqual, PtiUDE)
		cv.So(frame.Prim, cv.ShouldEqual, frame.Tm|int64(pti))
		by, err := frame.Marshal(nil)
		panicOn(err)
		Q("by = '%v'", string(by))

		var frame2 Frame
		frame2.Unmarshal(by)
		cv.So(&frame2, cv.ShouldResemble, frame)

	})

	cv.Convey("We should be able to marshal and unmarshal User typed messages (q-bit == 1; type numbers < 0)", t, func() {

		tm := time.Now()
		msg := []byte("fake msg")
		pti := PtiUDE
		utyp := Evtnum(-34)
		frame := NewFrame(tm, pti, utyp, 0, 0, msg)

		nano := tm.UnixNano()
		low3 := nano % 8

		cv.So(frame.Tm, cv.ShouldEqual, nano-low3)
		cv.So(string(frame.Data), cv.ShouldEqual, string(msg))
		cv.So(frame.Ulen, cv.ShouldEqual, len(msg))
		cv.So(frame.Ulen, cv.ShouldEqual, len(frame.Data))
		cv.So(frame.IsUser, cv.ShouldEqual, true)
		cv.So(frame.Pti, cv.ShouldEqual, PtiUDE)
		cv.So(frame.Prim, cv.ShouldEqual, frame.Tm|int64(pti))
		by, err := frame.Marshal(nil)
		panicOn(err)
		Q("by = '%v'", string(by))

		var frame2 Frame
		frame2.Unmarshal(by)
		cv.So(&frame2, cv.ShouldResemble, frame)

	})

}<commit_msg>atg. update test var names<commit_after>package frame

import (
	cv "github.com/glycerine/goconvey/convey"
	"testing"
	"time"
)

func TestParsingTMFRAME(t *testing.T) {
	cv.Convey("Given that we have a timestamp and a string message, we should be able to assemble and parse the TMFRAME message.", t, func() {

		tm := time.Now()
		msg := []byte("fake msg")
		pti := PtiUDE
		utyp := Utf8
		frame := NewFrame(tm, pti, utyp, 0, 0, msg)

		nano := tm.UnixNano()
		low3 := nano % 8

		cv.So(frame.Tm, cv.ShouldEqual, nano-low3)
		cv.So(string(frame.Data), cv.ShouldEqual, string(msg))
		cv.So(frame.Ulen, cv.ShouldEqual, len(msg))
		cv.So(frame.Ulen, cv.ShouldEqual, len(frame.Data))
		cv.So(frame.IsUser, cv.ShouldEqual, false)
		cv.So(frame.Pti, cv.ShouldEqual, PtiUDE)
		cv.So(frame.Prim, cv.ShouldEqual, frame.Tm|int64(pti))
		by, err := frame.Marshal(nil)
		panicOn(err)
		Q("by = '%v'", string(by))

		var frame2 Frame
		frame2.Unmarshal(by)
		cv.So(&frame2, cv.ShouldResemble, frame)

	})

	cv.Convey("We should be able to marshal and unmarshal User typed messages (q-bit == 1; with evnnum < 0)", t, func() {

		tm := time.Now()
		msg := []byte("fake msg")
		pti := PtiUDE
		evnum := Evtnum(-34)
		frame := NewFrame(tm, pti, evnum, 0, 0, msg)

		nano := tm.UnixNano()
		low3 := nano % 8

		cv.So(frame.Tm, cv.ShouldEqual, nano-low3)
		cv.So(string(frame.Data), cv.ShouldEqual, string(msg))
		cv.So(frame.Ulen, cv.ShouldEqual, len(msg))
		cv.So(frame.Ulen, cv.ShouldEqual, len(frame.Data))
		cv.So(frame.IsUser, cv.ShouldEqual, true)
		cv.So(frame.Pti, cv.ShouldEqual, PtiUDE)
		cv.So(frame.Prim, cv.ShouldEqual, frame.Tm|int64(pti))
		by, err := frame.Marshal(nil)
		panicOn(err)
		Q("by = '%v'", string(by))

		var frame2 Frame
		frame2.Unmarshal(by)
		cv.So(&frame2, cv.ShouldResemble, frame)
		cv.So(frame2.Evnum, cv.ShouldEqual, -34)
		Q("frame2.Tm = %v", time.Unix(0, frame2.Tm))
		Q("tm = %v", tm)
	})

}
{'fraction_non_alphanumeric': 0.17359611231101513, 'fraction_numerical': 0.01511879049676026, 'mean_word_length': 3.9007936507936507, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3655135', 'n_tokens_mistral': 1665, 'n_tokens_neox': 1523, 'n_words': 340}