~sbinet/star-tex

ref: 01f50749024c419b3b1800893d74a02994b9ecbb star-tex/font/pkf/pkf_test.go -rw-r--r-- 1.4 KiB
01f50749Sebastien Binet {cmd/pk2bm,font/pkf}: first import 1 year, 1 month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Copyright ©2021 The star-tex Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package pkf

import (
	"testing"
)

func TestOpCode(t *testing.T) {
	for _, tc := range []struct {
		opcode opCode
		want   opCode
	}{
		{opXXX1, 240},
		{opXXX2, 241},
		{opXXX3, 242},
		{opXXX4, 243},
		{opYYY, 244},
		{opPost, 245},
		{opNOP, 246},
		{opPre, 247},
	} {
		t.Run(tc.opcode.cmd().Name(), func(t *testing.T) {
			if got, want := tc.opcode, tc.want; got != want {
				t.Fatalf("invalid opcode value: got=%d, want=%d", got, want)
			}
		})
	}
}

//func TestReader(t *testing.T) {
//	ctx := kpath.New()
//	for _, tc := range []struct {
//		name string
//		want string
//	}{
//		{
//			name: "fonts/pk/ljfour/public/cm/dpi600/cmr10.pk",
//			want: "xx",
//		},
//	} {
//		t.Run(tc.name, func(t *testing.T) {
//			f, err := ctx.Open(tc.name)
//			if err != nil {
//				t.Fatalf("could not open PK file: %+v", err)
//			}
//			defer f.Close()
//
//			r := NewReader(f)
//			err = r.Read(func(cmd Cmd) error {
//				log.Printf("cmd: %#v", cmd)
//				if cmd, ok := cmd.(*CmdPre); ok {
//					log.Printf("design: %d", cmd.Design)
//					log.Printf("chksum: %d", cmd.Checksum)
//					log.Printf("hppp: %d", cmd.Hppp)
//					log.Printf("vppp: %d", cmd.Vppp)
//				}
//				return nil
//			})
//			if err != nil {
//				t.Fatalf("could not read PK file: %+v", err)
//			}
//		})
//	}
//}